public Shard( string typeName, string shardId, Func <string, Props> entityProps, ClusterShardingSettings settings, ExtractEntityId extractEntityId, ExtractShardId extractShardId, object handOffStopMessage) { TypeName = typeName; ShardId = shardId; EntityProps = entityProps; Settings = settings; ExtractEntityId = extractEntityId; ExtractShardId = extractShardId; HandOffStopMessage = handOffStopMessage; RememberedEntitiesRecoveryStrategy = Settings.TunningParameters.EntityRecoveryStrategy == "constant" ? EntityRecoveryStrategy.ConstantStrategy( Context.System, Settings.TunningParameters.EntityRecoveryConstantRateStrategyFrequency, Settings.TunningParameters.EntityRecoveryConstantRateStrategyNumberOfEntities) : EntityRecoveryStrategy.AllStrategy; var idleInterval = TimeSpan.FromTicks(Settings.PassivateIdleEntityAfter.Ticks / 2); PassivateIdleTask = Settings.PassivateIdleEntityAfter > TimeSpan.Zero && !Settings.RememberEntities ? Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(idleInterval, idleInterval, Self, PassivateIdleTick.Instance, Self) : null; this.Initialized(); }
public DDataShard( string typeName, ShardId shardId, Props entityProps, ClusterShardingSettings settings, ExtractEntityId extractEntityId, ExtractShardId extractShardId, object handOffStopMessage, IActorRef replicator, int majorityCap) { TypeName = typeName; ShardId = shardId; EntityProps = entityProps; Settings = settings; ExtractEntityId = extractEntityId; ExtractShardId = extractShardId; HandOffStopMessage = handOffStopMessage; Replicator = replicator; MajorityCap = majorityCap; RememberedEntitiesRecoveryStrategy = Settings.TunningParameters.EntityRecoveryStrategy == "constant" ? EntityRecoveryStrategy.ConstantStrategy( Context.System, Settings.TunningParameters.EntityRecoveryConstantRateStrategyFrequency, Settings.TunningParameters.EntityRecoveryConstantRateStrategyNumberOfEntities) : EntityRecoveryStrategy.AllStrategy; _readConsistency = new ReadMajority(settings.TunningParameters.WaitingForStateTimeout, majorityCap); _writeConsistency = new WriteMajority(settings.TunningParameters.UpdatingStateTimeout, majorityCap); _stateKeys = Enumerable.Range(0, NrOfKeys).Select(i => new ORSetKey <EntryId>($"shard-{typeName}-{shardId}-{i}")).ToImmutableArray(); GetState(); }
public PersistentShard( string typeName, string shardId, Func <string, Props> entityProps, ClusterShardingSettings settings, ExtractEntityId extractEntityId, ExtractShardId extractShardId, object handOffStopMessage) { TypeName = typeName; ShardId = shardId; EntityProps = entityProps; Settings = settings; ExtractEntityId = extractEntityId; ExtractShardId = extractShardId; HandOffStopMessage = handOffStopMessage; PersistenceId = "/sharding/" + TypeName + "Shard/" + ShardId; JournalPluginId = settings.JournalPluginId; SnapshotPluginId = settings.SnapshotPluginId; RememberedEntitiesRecoveryStrategy = Settings.TunningParameters.EntityRecoveryStrategy == "constant" ? EntityRecoveryStrategy.ConstantStrategy( Context.System, Settings.TunningParameters.EntityRecoveryConstantRateStrategyFrequency, Settings.TunningParameters.EntityRecoveryConstantRateStrategyNumberOfEntities) : EntityRecoveryStrategy.AllStrategy; }
public Shard( string typeName, string shardId, Func <string, Props> entityProps, ClusterShardingSettings settings, ExtractEntityId extractEntityId, ExtractShardId extractShardId, object handOffStopMessage) { TypeName = typeName; ShardId = shardId; EntityProps = entityProps; Settings = settings; ExtractEntityId = extractEntityId; ExtractShardId = extractShardId; HandOffStopMessage = handOffStopMessage; RememberedEntitiesRecoveryStrategy = Settings.TunningParameters.EntityRecoveryStrategy == "constant" ? EntityRecoveryStrategy.ConstantStrategy( Context.System, Settings.TunningParameters.EntityRecoveryConstantRateStrategyFrequency, Settings.TunningParameters.EntityRecoveryConstantRateStrategyNumberOfEntities) : EntityRecoveryStrategy.AllStrategy; this.Initialized(); }
public PersistentShard( string typeName, string shardId, Func <string, Props> entityProps, ClusterShardingSettings settings, ExtractEntityId extractEntityId, ExtractShardId extractShardId, object handOffStopMessage) { TypeName = typeName; ShardId = shardId; EntityProps = entityProps; Settings = settings; ExtractEntityId = extractEntityId; ExtractShardId = extractShardId; HandOffStopMessage = handOffStopMessage; PersistenceId = "/sharding/" + TypeName + "Shard/" + ShardId; JournalPluginId = settings.JournalPluginId; SnapshotPluginId = settings.SnapshotPluginId; RememberedEntitiesRecoveryStrategy = Settings.TunningParameters.EntityRecoveryStrategy == "constant" ? EntityRecoveryStrategy.ConstantStrategy( Context.System, Settings.TunningParameters.EntityRecoveryConstantRateStrategyFrequency, Settings.TunningParameters.EntityRecoveryConstantRateStrategyNumberOfEntities) : EntityRecoveryStrategy.AllStrategy; var idleInterval = TimeSpan.FromTicks(Settings.PassivateIdleEntityAfter.Ticks / 2); PassivateIdleTask = Settings.ShouldPassivateIdleEntities ? Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(idleInterval, idleInterval, Self, Shard.PassivateIdleTick.Instance, Self) : null; }
public DDataShard( string typeName, ShardId shardId, Func <string, Props> entityProps, ClusterShardingSettings settings, ExtractEntityId extractEntityId, ExtractShardId extractShardId, object handOffStopMessage, IActorRef replicator, int majorityCap) { TypeName = typeName; ShardId = shardId; EntityProps = entityProps; Settings = settings; ExtractEntityId = extractEntityId; ExtractShardId = extractShardId; HandOffStopMessage = handOffStopMessage; Replicator = replicator; MajorityCap = majorityCap; RememberedEntitiesRecoveryStrategy = Settings.TunningParameters.EntityRecoveryStrategy == "constant" ? EntityRecoveryStrategy.ConstantStrategy( Context.System, Settings.TunningParameters.EntityRecoveryConstantRateStrategyFrequency, Settings.TunningParameters.EntityRecoveryConstantRateStrategyNumberOfEntities) : EntityRecoveryStrategy.AllStrategy; var idleInterval = TimeSpan.FromTicks(Settings.PassivateIdleEntityAfter.Ticks / 2); PassivateIdleTask = Settings.ShouldPassivateIdleEntities ? Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(idleInterval, idleInterval, Self, Shard.PassivateIdleTick.Instance, Self) : null; _readConsistency = new ReadMajority(settings.TunningParameters.WaitingForStateTimeout, majorityCap); _writeConsistency = new WriteMajority(settings.TunningParameters.UpdatingStateTimeout, majorityCap); _stateKeys = Enumerable.Range(0, NrOfKeys).Select(i => new ORSetKey <EntryId>($"shard-{typeName}-{shardId}-{i}")).ToImmutableArray(); GetState(); }