sociomantic-tsunami / dlsproto

Distributed Log Store protocol definition, client, fake node, and tests
Boost Software License 1.0
3 stars 18 forks source link

D2 only; adapt to ocean, swarm, turtle new majors #110

Closed gavin-norman-sociomantic closed 5 years ago

gavin-norman-sociomantic commented 5 years ago

Current progress investigating the test failures:

tiyash-basu-sociomantic commented 5 years ago

The following change makes the tests pass:

diff --git a/src/dlsproto/node/neo/request/GetRange.d b/src/dlsproto/node/neo/request/GetRange.d
index 08f8175..b4a56cc 100644
--- a/src/dlsproto/node/neo/request/GetRange.d
+++ b/src/dlsproto/node/neo/request/GetRange.d
@@ -42,6 +42,7 @@ public abstract class GetRangeProtocol_v2: IRequest
     import swarm.util.RecordBatcher;
     import swarm.neo.node.RequestOnConn;
     import dlsproto.common.GetRange;
+    import dlsproto.node.neo.request.core.IRequestResources;
     public import dlsproto.client.request.GetRange: Filter;

     import core.stdc.time;
@@ -147,6 +148,9 @@ public abstract class GetRangeProtocol_v2: IRequest
     void handle ( RequestOnConn connection, Object resources,
         Const!(void)[] init_payload )
     {
+        this.ed = connection.event_dispatcher;
+        auto rq_resources = cast(IRequestResources)resources;
+
         cstring channel_name;
         cstring filter_string;
         time_t low, high;
@@ -190,11 +194,11 @@ public abstract class GetRangeProtocol_v2: IRequest
                 }
             );

-            this.value_buffer = this.resources.getVoidBuffer();
-            this.batch_buffer = this.resources.getVoidBuffer();
-            this.compressed_batch = this.resources.getVoidBuffer();
-            this.saved_exception = this.resources.getException();
-            this.lzo = this.resources.getLzo();
+            this.value_buffer = rq_resources.getVoidBuffer();
+            this.batch_buffer = rq_resources.getVoidBuffer();
+            this.compressed_batch = rq_resources.getVoidBuffer();
+            this.saved_exception = rq_resources.getException();
+            this.lzo = rq_resources.getLzo();

             try
             {
diff --git a/src/dlsproto/node/neo/request/Put.d b/src/dlsproto/node/neo/request/Put.d
index 74ff53c..a3fa50e 100644
--- a/src/dlsproto/node/neo/request/Put.d
+++ b/src/dlsproto/node/neo/request/Put.d
@@ -52,10 +52,12 @@ public abstract class PutProtocol_v1: IRequest
     void handle ( RequestOnConn connection, Object resources,
         Const!(void)[] init_payload )
     {
+        auto ed = connection.event_dispatcher;
+
         cstring channel;
         time_t timestamp;
         Const!(char)[] value;
-        this.ed.message_parser.parseBody(init_payload, channel, timestamp, value);
+        ed.message_parser.parseBody(init_payload, channel, timestamp, value);

         // Store the extracted data in StorageEngine
         RequestStatusCode response;
@@ -66,7 +68,7 @@ public abstract class PutProtocol_v1: IRequest
             response = RequestStatusCode.Error;

         // Send the response code.
-        this.ed.send(
+        ed.send(
             ( RequestOnConnBase.EventDispatcher.Payload payload )
             {
                 payload.addCopy(response);

The IRequestHandlerRequestCore.initialise method takes care of initialising the needed member variables here, but that method doesn't seem to be needed anymore.

gavin-norman-sociomantic commented 5 years ago

Updated.

gavin-norman-sociomantic commented 5 years ago

Updated to use swarm v6.0.0-rc.3.

gavin-norman-sociomantic commented 5 years ago

Updated with extra commits from https://github.com/tiyash-basu-sociomantic/dlsproto/commits/new-major.

gavin-norman-sociomantic commented 5 years ago

Newlined.