public DirectoryEvictor(DirectoryEvictionConfiguration config, Directory directory)
 {
     _config    = config;
     _directory = directory;
     Logger.Debug("Created with config: {}", config);
 }
        public void TestThatConfigurationConfirgures()
        {
            var configuration = Configuration
                                .Define()
                                .With(PooledCompletesPluginConfiguration
                                      .Define()
                                      .WithMailbox("queueMailbox")
                                      .WithPoolSize(10))
                                .With(SharedRingBufferMailboxPluginConfiguration
                                      .Define()
                                      .WithRingSize(65535)
                                      .WithFixedBackoff(2)
                                      .WithNotifyOnSend(true)
                                      .WithDispatcherThrottlingCount(10))
                                .With(ManyToOneConcurrentArrayQueuePluginConfiguration
                                      .Define()
                                      .WithRingSize(65535)
                                      .WithFixedBackoff(2)
                                      .WithNotifyOnSend(true)
                                      .WithDispatcherThrottlingCount(10)
                                      .WithSendRetires(10))
                                .With(ConcurrentQueueMailboxPluginConfiguration
                                      .Define()
                                      .WithDefaultMailbox()
                                      .WithNumberOfDispatchersFactor(1.5f)
                                      .WithNumberOfDispatchers(0)
                                      .WithDispatcherThrottlingCount(10))
                                .With(ConsoleLoggerPluginConfiguration
                                      .Define()
                                      .WithDefaultLogger()
                                      .WithName("vlingo-net/actors(test)"))
                                .With(CommonSupervisorsPluginConfiguration
                                      .Define()
                                      .WithSupervisor("default", "pingSupervisor", typeof(IPing), typeof(PingSupervisorActor))
                                      .WithSupervisor("default", "pongSupervisor", typeof(IPong), typeof(PongSupervisorActor)))
                                .With(DefaultSupervisorOverridePluginConfiguration
                                      .Define()
                                      .WithSupervisor("default", "overrideSupervisor", typeof(DefaultSupervisorOverride)))
                                .With(DirectoryEvictionConfiguration
                                      .Define()
                                      .WithFillRatioHigh(0.75F)
                                      .WithLruThresholdMillis(10000))
                                .UsingMainProxyGeneratedClassesPath("target/classes/")
                                .UsingMainProxyGeneratedSourcesPath("target/generated-sources/")
                                .UsingTestProxyGeneratedClassesPath("target/test-classes/")
                                .UsingTestProxyGeneratedSourcesPath("target/generated-test-sources/");

            Assert.NotNull(configuration);
            Assert.NotNull(configuration.PooledCompletesPluginConfiguration);
            Assert.Equal("queueMailbox", configuration.PooledCompletesPluginConfiguration.Mailbox);
            Assert.Equal(10, configuration.PooledCompletesPluginConfiguration.PoolSize);

            Assert.NotNull(configuration.SharedRingBufferMailboxPluginConfiguration);
            Assert.False(configuration.SharedRingBufferMailboxPluginConfiguration.IsDefaultMailbox);
            Assert.Equal(65535, configuration.SharedRingBufferMailboxPluginConfiguration.RingSize);
            Assert.Equal(2, configuration.SharedRingBufferMailboxPluginConfiguration.FixedBackoff);
            Assert.True(configuration.SharedRingBufferMailboxPluginConfiguration.NotifyOnSend);
            Assert.Equal(10, configuration.SharedRingBufferMailboxPluginConfiguration.DispatcherThrottlingCount);

            Assert.NotNull(configuration.ManyToOneConcurrentArrayQueuePluginConfiguration);
            Assert.False(configuration.ManyToOneConcurrentArrayQueuePluginConfiguration.IsDefaultMailbox);
            Assert.Equal(65535, configuration.ManyToOneConcurrentArrayQueuePluginConfiguration.RingSize);
            Assert.Equal(2, configuration.ManyToOneConcurrentArrayQueuePluginConfiguration.FixedBackoff);
            Assert.True(configuration.SharedRingBufferMailboxPluginConfiguration.NotifyOnSend);
            Assert.Equal(10, configuration.ManyToOneConcurrentArrayQueuePluginConfiguration.DispatcherThrottlingCount);

            Assert.NotNull(configuration.ConcurrentQueueMailboxPluginConfiguration);
            Assert.True(configuration.ConcurrentQueueMailboxPluginConfiguration.IsDefaultMailbox);
            Assert.Equal(1.5f, configuration.ConcurrentQueueMailboxPluginConfiguration.NumberOfDispatchersFactor, 0);
            Assert.Equal(10, configuration.ConcurrentQueueMailboxPluginConfiguration.DispatcherThrottlingCount);

            Assert.NotNull(configuration.ConsoleLoggerPluginConfiguration);
            Assert.True(configuration.ConsoleLoggerPluginConfiguration.IsDefaultLogger);
            Assert.Equal("vlingo-net/actors(test)", configuration.ConsoleLoggerPluginConfiguration.Name);

            Assert.NotNull(configuration.CommonSupervisorsPluginConfiguration);
            Assert.Equal(2, configuration.CommonSupervisorsPluginConfiguration.Count);
            Assert.Equal("default", configuration.CommonSupervisorsPluginConfiguration.StageName(0));
            Assert.Equal("pingSupervisor", configuration.CommonSupervisorsPluginConfiguration.SupervisorName(0));
            Assert.Equal(typeof(IPing), configuration.CommonSupervisorsPluginConfiguration.SupervisedProtocol(0));
            Assert.Equal(typeof(PingSupervisorActor), configuration.CommonSupervisorsPluginConfiguration.SupervisorClass(0));
            Assert.Equal("default", configuration.CommonSupervisorsPluginConfiguration.StageName(1));
            Assert.Equal("pongSupervisor", configuration.CommonSupervisorsPluginConfiguration.SupervisorName(1));
            Assert.Equal(typeof(IPong), configuration.CommonSupervisorsPluginConfiguration.SupervisedProtocol(1));
            Assert.Equal(typeof(PongSupervisorActor), configuration.CommonSupervisorsPluginConfiguration.SupervisorClass(1));

            Assert.NotNull(configuration.DefaultSupervisorOverridePluginConfiguration);
            Assert.Equal(1, configuration.DefaultSupervisorOverridePluginConfiguration.Count);
            Assert.Equal("default", configuration.DefaultSupervisorOverridePluginConfiguration.StageName(0));
            Assert.Equal("overrideSupervisor", configuration.DefaultSupervisorOverridePluginConfiguration.Name);
            Assert.Equal(typeof(DefaultSupervisorOverride), configuration.DefaultSupervisorOverridePluginConfiguration.SupervisorClass(0));

            Assert.Equal("directoryEviction", configuration.DirectoryEvictionConfiguration.Name);
            Assert.Equal(10000, configuration.DirectoryEvictionConfiguration.LruThresholdMillis);
            Assert.Equal(0.75F, configuration.DirectoryEvictionConfiguration.FillRatioHigh, 0);

            Assert.Equal("target/classes/", configuration.MainProxyGeneratedClassesPath);
            Assert.Equal("target/generated-sources/", configuration.MainProxyGeneratedSourcesPath);
            Assert.Equal("target/test-classes/", configuration.TestProxyGeneratedClassesPath);
            Assert.Equal("target/generated-test-sources/", configuration.TestProxyGeneratedSourcesPath);
        }
 public Configuration With(DirectoryEvictionConfiguration configuration)
 {
     DirectoryEvictionConfiguration ??= configuration;
     AddConfigurationOverride(configuration);
     return(this);
 }
Example #4
0
 private DirectoryEvictionPlugin(DirectoryEvictionConfiguration configuration) => _configuration = configuration;
Example #5
0
 public DirectoryEvictionPlugin() : this(DirectoryEvictionConfiguration.Define())
 {
 }
Example #6
0
 public DirectoryEvictionPlugin(string?name = null) : this(DirectoryEvictionConfiguration.Define())
 {
 }