Skip to content

Commit

Permalink
Auto-convert to D2
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-wende-sociomantic committed Nov 23, 2018
1 parent 7a1bbf0 commit ccba9d8
Show file tree
Hide file tree
Showing 47 changed files with 359 additions and 359 deletions.
58 changes: 29 additions & 29 deletions src/dhtproto/client/DhtClient.d
Expand Up @@ -560,7 +560,7 @@ public class DhtClient : IClient
***********************************************************************/

public void opCall ( RequestParams.GetBoolDg output,
public void opCall ( scope RequestParams.GetBoolDg output,
NotifierDg user_notifier )
{
this.reset(output, user_notifier);
Expand All @@ -585,7 +585,7 @@ public class DhtClient : IClient
***********************************************************************/

private void reset ( RequestParams.GetBoolDg output,
private void reset ( scope RequestParams.GetBoolDg output,
NotifierDg user_notifier )
{
this.output = output;
Expand Down Expand Up @@ -993,8 +993,8 @@ public class DhtClient : IClient
***************************************************************************/

public void nodeHandshake ( RequestParams.GetBoolDg output,
RequestNotification.Callback user_notifier )
public void nodeHandshake ( scope RequestParams.GetBoolDg output,
scope RequestNotification.Callback user_notifier )
{
this.node_handshake(output, user_notifier);
}
Expand Down Expand Up @@ -1066,8 +1066,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public Put put ( Key ) ( cstring channel, Key key, RequestParams.PutValueDg input,
RequestNotification.Callback notifier )
public Put put ( Key ) ( cstring channel, Key key, scope RequestParams.PutValueDg input,
scope RequestNotification.Callback notifier )
{
return *Put(DhtConst.Command.E.Put, notifier).channel(channel).key(key)
.io(input).contextFromKey();
Expand Down Expand Up @@ -1106,8 +1106,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public Get get ( Key ) ( cstring channel, Key key, RequestParams.GetValueDg output,
RequestNotification.Callback notifier )
public Get get ( Key ) ( cstring channel, Key key, scope RequestParams.GetValueDg output,
scope RequestNotification.Callback notifier )
{
return *Get(DhtConst.Command.E.Get, notifier).channel(channel).key(key)
.io(output).contextFromKey();
Expand Down Expand Up @@ -1144,8 +1144,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public Exists exists ( Key ) ( cstring channel, Key key, RequestParams.GetBoolDg output,
RequestNotification.Callback notifier )
public Exists exists ( Key ) ( cstring channel, Key key, scope RequestParams.GetBoolDg output,
scope RequestNotification.Callback notifier )
{
return *Exists(DhtConst.Command.E.Exists, notifier).channel(channel)
.key(key).io(output).contextFromKey();
Expand Down Expand Up @@ -1177,7 +1177,7 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public Remove remove ( Key ) ( cstring channel, Key key, RequestNotification.Callback notifier )
public Remove remove ( Key ) ( cstring channel, Key key, scope RequestNotification.Callback notifier )
{
return *Remove(DhtConst.Command.E.Remove, notifier).channel(channel)
.key(key).contextFromKey();
Expand Down Expand Up @@ -1222,8 +1222,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public GetAll getAll ( cstring channel, RequestParams.GetPairDg output,
RequestNotification.Callback notifier )
public GetAll getAll ( cstring channel, scope RequestParams.GetPairDg output,
scope RequestNotification.Callback notifier )
{
return *GetAll(DhtConst.Command.E.GetAll, notifier).channel(channel)
.io(output);
Expand Down Expand Up @@ -1267,8 +1267,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public GetAllKeys getAllKeys ( cstring channel, RequestParams.GetValueDg output,
RequestNotification.Callback notifier )
public GetAllKeys getAllKeys ( cstring channel, scope RequestParams.GetValueDg output,
scope RequestNotification.Callback notifier )
{
return *GetAllKeys(DhtConst.Command.E.GetAllKeys, notifier)
.channel(channel).io(output);
Expand Down Expand Up @@ -1311,8 +1311,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public Listen listen ( cstring channel, RequestParams.GetPairDg output,
RequestNotification.Callback notifier )
public Listen listen ( cstring channel, scope RequestParams.GetPairDg output,
scope RequestNotification.Callback notifier )
{
return *Listen(DhtConst.Command.E.Listen, notifier).channel(channel)
.io(output);
Expand Down Expand Up @@ -1354,8 +1354,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public GetChannels getChannels ( RequestParams.GetNodeValueDg output,
RequestNotification.Callback notifier )
public GetChannels getChannels ( scope RequestParams.GetNodeValueDg output,
scope RequestNotification.Callback notifier )
{
return *GetChannels(DhtConst.Command.E.GetChannels, notifier).io(output);
}
Expand Down Expand Up @@ -1395,7 +1395,7 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public GetSize getSize ( RequestParams.GetSizeInfoDg output, RequestNotification.Callback notifier )
public GetSize getSize ( scope RequestParams.GetSizeInfoDg output, scope RequestNotification.Callback notifier )
{
return *GetSize(DhtConst.Command.E.GetSize, notifier).io(output);
}
Expand Down Expand Up @@ -1438,7 +1438,7 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public GetChannelSize getChannelSize ( cstring channel, RequestParams.GetChannelSizeInfoDg output, RequestNotification.Callback notifier )
public GetChannelSize getChannelSize ( cstring channel, scope RequestParams.GetChannelSizeInfoDg output, scope RequestNotification.Callback notifier )
{
return *GetChannelSize(DhtConst.Command.E.GetChannelSize, notifier)
.channel(channel).io(output);
Expand Down Expand Up @@ -1472,7 +1472,7 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public RemoveChannel removeChannel ( cstring channel, RequestNotification.Callback notifier )
public RemoveChannel removeChannel ( cstring channel, scope RequestNotification.Callback notifier )
{
return *RemoveChannel(DhtConst.Command.E.RemoveChannel, notifier)
.channel(channel);
Expand Down Expand Up @@ -1513,8 +1513,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public GetNumConnections getNumConnections ( RequestParams.GetNumConnectionsDg output,
RequestNotification.Callback notifier )
public GetNumConnections getNumConnections ( scope RequestParams.GetNumConnectionsDg output,
scope RequestNotification.Callback notifier )
{
return *GetNumConnections(DhtConst.Command.E.GetNumConnections, notifier)
.io(output);
Expand Down Expand Up @@ -1557,8 +1557,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public GetVersion getVersion ( RequestParams.GetNodeValueDg output,
RequestNotification.Callback notifier )
public GetVersion getVersion ( scope RequestParams.GetNodeValueDg output,
scope RequestNotification.Callback notifier )
{
return *GetVersion(DhtConst.Command.E.GetVersion, notifier).io(output);
}
Expand Down Expand Up @@ -1599,8 +1599,8 @@ public class DhtClient : IClient
mixin RequestParamsSetup; // private setup() method, used by assign()
}

public GetResponsibleRange getResponsibleRange ( RequestParams.GetResponsibleRangeDg output,
RequestNotification.Callback notifier )
public GetResponsibleRange getResponsibleRange ( scope RequestParams.GetResponsibleRangeDg output,
scope RequestNotification.Callback notifier )
{
return *GetResponsibleRange(DhtConst.Command.E.GetResponsibleRange,
notifier).io(output);
Expand All @@ -1623,7 +1623,7 @@ public class DhtClient : IClient
***************************************************************************/

override protected void scopeRequestParams (
void delegate ( IRequestParams params ) dg )
scope void delegate ( IRequestParams params ) dg )
{
scope params = new RequestParams;
dg(params);
Expand Down
12 changes: 6 additions & 6 deletions src/dhtproto/client/NotifierTypes.d
Expand Up @@ -47,12 +47,12 @@ public struct RequestRecordInfo
***************************************************************************/

public void toString ( void delegate ( cstring chunk ) sink )
public void toString ( scope void delegate ( cstring chunk ) sink )
{
Formatter.sformat(
sink,
"Request #{} provided the record 0x{:x16}:{}",
this.request_id, this.key, this.value);
(&this).request_id, (&this).key, (&this).value);
}
}

Expand Down Expand Up @@ -92,12 +92,12 @@ public struct RequestDataUpdateInfo
***************************************************************************/

public void toString ( void delegate ( cstring chunk ) sink )
public void toString ( scope void delegate ( cstring chunk ) sink )
{
Formatter.sformat(
sink,
"Request #{} provided the record {} to be updated",
this.request_id, this.value);
(&this).request_id, (&this).value);
}
}

Expand Down Expand Up @@ -126,12 +126,12 @@ public struct RequestKeyInfo
***************************************************************************/

public void toString ( void delegate ( cstring chunk ) sink )
public void toString ( scope void delegate ( cstring chunk ) sink )
{
Formatter.sformat(
sink,
"Request #{} provided the key 0x{:x16}",
this.request_id, this.key);
(&this).request_id, (&this).key);
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/dhtproto/client/internal/NodeHashRanges.d
Expand Up @@ -53,7 +53,7 @@ public final class NodeHashRanges : NodeHashRangesBase
***************************************************************************/

public this ( ConnectionSet connections, NewNodeNotifier new_node_dg )
public this ( ConnectionSet connections, scope NewNodeNotifier new_node_dg )
{
this.connections = connections;
this.new_node_dg = new_node_dg;
Expand Down Expand Up @@ -88,8 +88,8 @@ public final class NodeHashRanges : NodeHashRangesBase
***************************************************************************/

public void getFromNode ( hash_t h,
VoidBufferAsArrayOf!(NodeHashRange) node_hash_ranges, UseNodeDg use_node,
bool delegate ( RequestOnConn.EventDispatcher ) get )
VoidBufferAsArrayOf!(NodeHashRange) node_hash_ranges, scope UseNodeDg use_node,
scope bool delegate ( RequestOnConn.EventDispatcher ) get )
{
auto nodes = this.getNodesForHash(h, node_hash_ranges);
if ( nodes.length == 0 )
Expand Down Expand Up @@ -146,8 +146,8 @@ public final class NodeHashRanges : NodeHashRangesBase
***************************************************************************/

public void removeFromNodes ( hash_t h,
VoidBufferAsArrayOf!(NodeHashRange) node_hash_ranges, UseNodeDg use_node,
bool delegate ( RequestOnConn.EventDispatcher ) remove )
VoidBufferAsArrayOf!(NodeHashRange) node_hash_ranges, scope UseNodeDg use_node,
scope bool delegate ( RequestOnConn.EventDispatcher ) remove )
{
auto nodes = this.getNodesForHash(h, node_hash_ranges);
if ( nodes.length == 0 )
Expand Down Expand Up @@ -190,8 +190,8 @@ public final class NodeHashRanges : NodeHashRangesBase
***************************************************************************/

public void putToNode ( hash_t h,
VoidBufferAsArrayOf!(NodeHashRange) node_hash_ranges, UseNodeDg use_node,
void delegate ( RequestOnConn.EventDispatcher ) put )
VoidBufferAsArrayOf!(NodeHashRange) node_hash_ranges, scope UseNodeDg use_node,
scope void delegate ( RequestOnConn.EventDispatcher ) put )
{
auto nodes = this.getNodesForHash(h, node_hash_ranges);
if ( nodes.length == 0 )
Expand Down
2 changes: 1 addition & 1 deletion src/dhtproto/client/internal/SharedResources.d
Expand Up @@ -245,7 +245,7 @@ public final class SharedResources
***********************************************************************/

public MessageFiber getFiber ( void delegate ( ) fiber_method )
public MessageFiber getFiber ( scope void delegate ( ) fiber_method )
{
bool new_fiber = false;

Expand Down
6 changes: 3 additions & 3 deletions src/dhtproto/client/legacy/DhtConst.d
Expand Up @@ -56,7 +56,7 @@ static:
***************************************************************************/

public const ApiVersion = "20110401";
public enum ApiVersion = "20110401";


/***************************************************************************
Expand All @@ -66,7 +66,7 @@ static:
***************************************************************************/

public const RecordSizeLimit = RecordBatcher.DefaultMaxBatchSize;
public enum RecordSizeLimit = RecordBatcher.DefaultMaxBatchSize;


/***************************************************************************
Expand Down Expand Up @@ -221,6 +221,6 @@ public struct NodeHashRange

public equals_t opEquals ( NodeHashRange rhs )
{
return this.opCmp(rhs) == 0;
return (&this).opCmp(rhs) == 0;
}
}
4 changes: 2 additions & 2 deletions src/dhtproto/client/legacy/common/NodeRecordBatcher.d
Expand Up @@ -95,10 +95,10 @@ public class NodeRecordBatcher
{
private hash_t[] hashes;

public int opApply ( int delegate ( ref hash_t hash ) dg )
public int opApply ( scope int delegate ( ref hash_t hash ) dg )
{
int r;
foreach ( h; this.hashes )
foreach ( h; (&this).hashes )
{
r = dg(h);
if ( r ) break;
Expand Down
12 changes: 6 additions & 6 deletions src/dhtproto/client/legacy/internal/helper/ChannelMirror.d
Expand Up @@ -79,7 +79,7 @@ abstract public class ChannelMirror ( Dht : DhtClient ) : MirrorBase!(Dht)
***********************************************************************/

public this ( Dht.RequestNotification.Callback notifier = null )
public this ( scope Dht.RequestNotification.Callback notifier = null )
{
super(this.outer.dht.listen(this.outer.channel_,
&this.outer.listenReceiveRecord, notifier));
Expand Down Expand Up @@ -158,7 +158,7 @@ abstract public class ChannelMirror ( Dht : DhtClient ) : MirrorBase!(Dht)
***********************************************************************/

public this ( Dht.RequestNotification.Callback notifier = null )
public this ( scope Dht.RequestNotification.Callback notifier = null )
{
super(this.outer.dht.getAll(this.outer.channel_,
&this.outer.getAllReceiveRecord,
Expand Down Expand Up @@ -273,7 +273,7 @@ abstract public class ChannelMirror ( Dht : DhtClient ) : MirrorBase!(Dht)

public this ( Dht dht, cstring channel,
uint update_time_s, uint retry_time_s,
Dht.RequestNotification.Callback notifier = null )
scope Dht.RequestNotification.Callback notifier = null )
{
super(dht, channel, update_time_s, retry_time_s);

Expand Down Expand Up @@ -305,7 +305,7 @@ abstract public class ChannelMirror ( Dht : DhtClient ) : MirrorBase!(Dht)
public this ( Dht dht, cstring channel,
uint update_time_s, uint retry_time_s,
lazy ListenRequest listen, lazy GetAllRequest get_all,
Dht.RequestNotification.Callback notifier = null )
scope Dht.RequestNotification.Callback notifier = null )
{
super(dht, channel, update_time_s, retry_time_s);

Expand Down Expand Up @@ -437,8 +437,8 @@ unittest
// Dummy concrete channel mirror class
class Mirror : ChannelMirror!(SchedulingDhtClient)
{
const UpdatePeriod = 60; // do a GetAll every 60 seconds
const RetryPeriod = 3; // retry failed requests after 3 seconds
static immutable UpdatePeriod = 60; // do a GetAll every 60 seconds
static immutable RetryPeriod = 3; // retry failed requests after 3 seconds

public this ( SchedulingDhtClient dht, in char[] channel )
{
Expand Down

0 comments on commit ccba9d8

Please sign in to comment.