private static async Task Main() { Console.WriteLine("Put the ddata mdb file in a folder called cluster-data in the application root folder. Press a key when done"); Console.Read(); var cfg = ConfigurationFactory.ParseString(File.ReadAllText("HOCON")) .WithFallback(DistributedData.DefaultConfig()); var originalColour = Console.ForegroundColor; var sys = ActorSystem.Create("test", cfg); var dd = DistributedData.Get(sys); int emptyKeyCount = 0; var resp = await dd.Replicator.Ask <GetKeysIdsResult>(Dsl.GetKeyIds); foreach (var resultKey in resp.Keys) { var key = new ORSetKey <string>($"{resultKey}"); var keyResp = await dd.Replicator.Ask <IGetResponse>(Dsl.Get(key)); Console.ForegroundColor = ConsoleColor.Green; if (keyResp.Get(key).Elements.Count == 0) { emptyKeyCount++; } Console.WriteLine($"{key.Id}\t{string.Join<string>(",", keyResp.Get(key).Elements)}"); } Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"Finished loading {resp.Keys.Count} keys. There were {emptyKeyCount} empty keys"); Console.ForegroundColor = originalColour; }
public DurableDataSpecConfig(bool writeBehind) { First = Role("first"); Second = Role("second"); var tempDir = Path.Combine(Path.GetTempPath(), "target", $"DurableDataSpec-{DateTime.UtcNow.Ticks}-ddata"); CommonConfig = DebugConfig(false) .WithFallback(ConfigurationFactory.ParseString($@" akka.loglevel = INFO akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"" akka.log-dead-letters-during-shutdown = off akka.cluster.distributed-data.durable.keys = [""durable*""] akka.cluster.distributed-data.durable.lmdb {{ dir = """"""{tempDir}"""""" map-size = 10 MiB write-behind-interval = {(writeBehind ? "200ms" : "off")} }} akka.cluster.distributed-data.durable.store-actor-class = ""Akka.DistributedData.LightningDB.LmdbDurableStore, Akka.DistributedData.LightningDB"" # initialization of lmdb can be very slow in CI environment akka.test.single-expect-default = 15s")) .WithFallback(DistributedData.DefaultConfig()); TestTransport = true; }
static ReplicatorSpecs() { SpecConfig = ConfigurationFactory.ParseString(@" akka.loglevel = DEBUG akka.actor.provider = cluster akka.remote.dot-netty.tcp.port = 0") .WithFallback(DistributedData.DefaultConfig()); }
static ReplicatorResiliencySpec() { SpecConfig = ConfigurationFactory.ParseString(@" akka.loglevel = DEBUG akka.actor.provider = cluster akka.remote.dot-netty.tcp.port = 0 akka.cluster.distributed-data.durable.keys = [""*""] akka.cluster.distributed-data.durable.store-actor-class = ""Akka.DistributedData.Tests.FakeDurableStore, Akka.DistributedData.Tests") .WithFallback(DistributedData.DefaultConfig()); }
public ReplicatorPruningSpecConfig() { First = Role("first"); Second = Role("second"); Third = Role("third"); CommonConfig = ConfigurationFactory.ParseString(@" akka.loglevel = INFO akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"" akka.log-dead-letters-during-shutdown = off") .WithFallback(DistributedData.DefaultConfig()); }
public ReplicatorSpecConfig() { First = Role("first"); Second = Role("second"); Third = Role("third"); CommonConfig = ConfigurationFactory.ParseString(@" akka.actor.provider = cluster akka.loglevel = DEBUG akka.log-dead-letters-during-shutdown = on ").WithFallback(DistributedData.DefaultConfig()); TestTransport = true; }
public DurablePruningSpecConfig() { First = Role("first"); Second = Role("second"); CommonConfig = DebugConfig(on: false).WithFallback(ConfigurationFactory.ParseString(@" akka.loglevel = INFO akka.actor.provider = ""cluster"" akka.log-dead-letters-during-shutdown = off akka.cluster.distributed-data.durable.keys = [""*""] akka.cluster.distributed-data.durable.lmdb { dir = ""target/DurablePruningSpec-" + DateTime.UtcNow.Ticks + @"-ddata"" map-size = 10 MiB }")).WithFallback(DistributedData.DefaultConfig()); }
public ReplicatorPruningSpecConfig() { First = Role("first"); Second = Role("second"); Third = Role("third"); CommonConfig = ConfigurationFactory.ParseString(@" akka.loglevel = DEBUG akka.actor.provider = cluster # we use 3s as write timeouts in test, make sure we see that # and not time out the expectMsg at the same time akka.test.single-expect-default = 5s akka.log-dead-letters-during-shutdown = off") .WithFallback(DistributedData.DefaultConfig()); }
public ReplicatorChaosSpecConfig() { First = Role("first"); Second = Role("second"); Third = Role("third"); Fourth = Role("fourth"); Fifth = Role("fifth"); CommonConfig = ConfigurationFactory.ParseString(@" akka.loglevel = INFO akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"" akka.cluster.roles = [""backend""] akka.log-dead-letters-during-shutdown = off") .WithFallback(DistributedData.DefaultConfig()); TestTransport = true; }
public ActorDirectoryTestsConfig() { First = Role("first"); Second = Role("second"); Third = Role("third"); CommonConfig = ConfigurationFactory.ParseString($@" akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"" akka.loglevel = DEBUG akka.log-dead-letters-during-shutdown = off akka.test.timefactor = 1 akka.cluster.roles = [ {Hexagon.Constants.NodeRoleName} ] ") .WithFallback(MultiNodeClusterSpec.ClusterConfig()) .WithFallback(DistributedData.DefaultConfig()); }
public XmlMessageSystemTestsConfig() { First = Role("first"); Second = Role("second"); Third = Role("third"); CommonConfig = ConfigurationFactory .ParseString(@" akka.loglevel = DEBUG akka.test.timefactor = 1 ") .WithFallback(MultiNodeClusterSpec.ClusterConfig()) .WithFallback(DistributedData.DefaultConfig()) .WithFallback(DistributedPubSub.DefaultConfig()); //TestTransport = true; }
public ReplicatorSpecConfig() { First = Role("first"); Second = Role("second"); Third = Role("third"); CommonConfig = DebugConfig(true).WithFallback(ConfigurationFactory.ParseString(@" akka.actor.provider=""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"" akka.test.timefactor=1.0 akka.test.calling-thread-dispatcher.type=""Akka.TestKit.CallingThreadDispatcherConfigurator, Akka.TestKit"" akka.test.calling-thread-dispatcher.throughput=2147483647 akka.test.test-actor.dispatcher.type=""Akka.TestKit.CallingThreadDispatcherConfigurator, Akka.TestKit"" akka.test.test-actor.dispatcher.throughput=2147483647 akka.cluster.distributed-data.gossip-interval=2s ")).WithFallback(DistributedData.DefaultConfig()); TestTransport = true; }
public XmlMessageSystemWithRemoteDeployTestsConfig() { DeployTarget1 = Role("deployTarget1"); DeployTarget2 = Role("deployTarget2"); Deployer = Role("deployer"); CommonConfig = ConfigurationFactory .ParseString(@" akka.loglevel = DEBUG akka.test.timefactor = 1 akka.log-config-on-start = on akka.cluster.roles = [ ""routeHere"" ] ") .WithFallback(MultiNodeClusterSpec.ClusterConfig()) .WithFallback(DistributedData.DefaultConfig()) .WithFallback(DistributedPubSub.DefaultConfig()); }
public DurableDataSpecConfig(bool writeBehind) { First = Role("first"); Second = Role("second"); var writeBehindInterval = writeBehind ? "200ms" : "off"; CommonConfig = ConfigurationFactory.ParseString(@" akka.loglevel = INFO akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"" akka.log-dead-letters-during-shutdown = off akka.cluster.distributed-data.durable.keys = [""durable*""] akka.cluster.distributed-data.durable.lmdb { dir = ""target/DurableDataSpec-" + DateTime.UtcNow.Ticks + @"-ddata"" map-size = 10 MiB write-behind-interval = " + writeBehindInterval + @" } akka.test.single-expect-default = 5s").WithFallback(DistributedData.DefaultConfig()); }
public JepsenInspiredInsertSpecConfig() { Controller = Role("controller"); N1 = Role("n1"); N2 = Role("n2"); N3 = Role("n3"); N4 = Role("n4"); N5 = Role("n5"); CommonConfig = ConfigurationFactory.ParseString(@" akka.loglevel = INFO akka.actor.provider = cluster akka.log-dead-letters = off akka.log-dead-letters-during-shutdown = off akka.remote.log-remote-lifecycle-events = ERROR akka.testconductor.barrier-timeout = 60s") .WithFallback(DistributedData.DefaultConfig()); TestTransport = true; }
public DurableDataPocoSpecConfig(bool writeBehind) { First = Role("first"); Second = Role("second"); Third = Role("third"); var tempDir = Path.Combine(Path.GetTempPath(), "target", "DurableDataPocoSpec", $"Spec-{DateTime.UtcNow.Ticks}"); CommonConfig = ConfigurationFactory.ParseString($@" akka.loglevel = INFO akka.log-config-on-start = off akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"" akka.log-dead-letters-during-shutdown = off akka.cluster.distributed-data.durable.keys = [""durable*""] akka.cluster.distributed-data.durable.lmdb {{ map-size = 10 MiB write-behind-interval = {(writeBehind ? "200ms" : "off")} }} akka.cluster.distributed-data.durable.store-actor-class = ""Akka.DistributedData.LightningDB.LmdbDurableStore, Akka.DistributedData.LightningDB"" # initialization of lmdb can be very slow in CI environment akka.test.single-expect-default = 15s") .WithFallback(DistributedData.DefaultConfig()); NodeConfig(new[] { First }, new[] { ConfigurationFactory.ParseString($@" akka.cluster.distributed-data.durable.lmdb {{ dir = ""target/DurableDataPocoSpec/first-ddata"" }} ") }); NodeConfig(new[] { Second }, new[] { ConfigurationFactory.ParseString($@" akka.cluster.distributed-data.durable.lmdb {{ dir = ""target/DurableDataPocoSpec/second-ddata"" }} ") }); NodeConfig(new[] { Third }, new[] { ConfigurationFactory.ParseString($@" akka.cluster.distributed-data.durable.lmdb {{ dir = ""target/DurableDataPocoSpec/third-ddata"" }} ") }); }
/// <summary> /// the HOCON is set to DEBUG logs, to show the behaviour of DData with this small dataset. If you set to WARNING, you can use key commands m, c and i to just mimic how I interact with ddata. /// </summary> /// <param name="args"></param> static void Main(string[] args) { var finalConfig = ConfigurationFactory.Empty.FromEnvironment(); var cfg = finalConfig.WithFallback(ConfigurationFactory.ParseString(File.ReadAllText("HOCON"))) .BootstrapFromDocker() .WithFallback(DistributedData.DefaultConfig()); Task.Run(() => { Sys1 = ActorSystem.Create("test", cfg); var cluster1 = Cluster.Get(Sys1); cluster1.Join(Address.Parse($"akka.tcp://test@{cluster1.SelfAddress.Host}:18001")); cluster1.RegisterOnMemberUp(() => StartActors(Sys1)); }); char command = Char.MinValue; while (!command.Equals('q')) { command = Console.ReadKey().KeyChar; switch (command) { case 'm': SendEventMessageToRegistry(Sys1); break; case 'c': SendCloseMessageToRegistry(Sys1); break; case 'i': QueryDDataThroughActor(Sys1); break; } } }