From b54a0dae0ec9dc34e2746dc33e5bbcc91303c23f Mon Sep 17 00:00:00 2001 From: Tomasz Jaskula Date: Thu, 22 Apr 2021 23:52:45 +0200 Subject: [PATCH] Move Vlingo.Actors to Vlingo.Xoom.Actors --- .github/workflows/dotnet.yml | 6 +- Directory.Build.props | 2 +- README.md | 12 +- appveyor.yml | 6 +- .../ActorEnvironmentTest.cs | 0 .../ActorFactoryTest.cs | 0 .../ActorLifecycleTest.cs | 0 .../ActorMessageSendingSpeedTest.cs | 0 .../ActorProxyBaseTest.cs | 0 .../ActorStopTest.cs | 0 .../ActorStowDisperseTest.cs | 0 .../ActorSuspendResumeTest.cs | 0 .../ActorsTest.cs | 0 .../AddressTest.cs | 0 .../AnswerEventuallyTest.cs | 0 .../BroadcastRouterTest.cs | 0 .../CharactersTest.cs | 0 .../CompletesActorProtocolTest.cs | 0 .../ConfigurationTest.cs | 0 .../ContentBasedRouterTest.cs | 0 .../Converter.cs | 0 .../DeadLettersTest.cs | 0 .../DefinitionTest.cs | 0 .../DirectoryTest.cs | 0 .../DispatcherTest.cs | 0 .../GenericWithConstraints__Proxy.cs | 0 .../GuidAddressTest.cs | 0 .../InterruptableActorTest.cs | 0 .../LocalMessageTest.cs | 0 .../MockCompletes.cs | 0 .../Completes/MockCompletesEventually.cs | 0 .../MockCompletesEventuallyProvider.cs | 0 .../Plugin/Completes/MockCompletesPlugin.cs | 0 .../Plugin/Completes/MockRegistrar.cs | 0 .../Completes/PooledCompletesPluginTest.cs | 0 .../Completes/PooledCompletesProviderTest.cs | 4 +- .../Plugin/Logging/ConsoleLoggerTest.cs | 0 ...ToOneConcurrentArrayQueueDispatcherTest.cs | 0 ...OneConcurrentArrayQueueMailboxActorTest.cs | 2 +- .../ConcurrentQueueMailboxTest.cs | 0 .../ConcurrentQueue/ExecutorDispatcherTest.cs | 0 .../DefaultMailboxProviderKeeperPluginTest.cs | 0 .../DefaultMailboxProviderKeeperTest.cs | 0 .../Plugin/Mailbox/ICountTaker.cs | 0 ...iesFileConfigRingBufferMailboxActorTest.cs | 0 .../RingBufferDispatcherTest.cs | 0 .../RingBufferMailboxActorTest.cs | 2 +- .../Plugin/PluginPropertiesTest.cs | 0 .../ProtocolsTest.cs | 0 .../ProxyGeneratorTests.cs | 24 +- .../ProxyLookupTest.cs | 0 .../RandomRouterTest.cs | 0 .../ReusableQueueMailboxTest.cs | 0 .../RoundRobinRouterTest.cs | 0 .../SchedulerTest.cs | 0 .../SmallestMailboxRouterTest.cs | 0 .../StageNamedTest.cs | 0 .../StageSupervisedActorTest.cs | 0 .../StageTest.cs | 0 .../StowageTest.cs | 0 .../Supervision/BasicSupervisionTest.cs | 0 .../Supervision/CommonSupervisionTest.cs | 0 .../DefaultSupervisorOverrideTest.cs | 0 .../Supervision/EscalateSupervisorActor.cs | 0 .../Supervision/FailureControlActor.cs | 0 .../Supervision/IFailureControl.cs | 0 .../Supervision/IFailureControlSender.cs | 0 .../Supervision/IPing.cs | 0 .../Supervision/IPong.cs | 0 .../Supervision/PingActor.cs | 0 .../Supervision/PingSupervisorActor.cs | 0 .../Supervision/PongActor.cs | 0 .../Supervision/PongSupervisorActor.cs | 0 .../RestartFiveInOneSupervisorActor.cs | 0 .../RestartForeverSupervisorActor.cs | 0 .../ResumeForeverSupervisorActor.cs | 0 .../Supervision/StopAllSupervisorActor.cs | 0 .../Supervision/SupervisionStrategyTest.cs | 0 .../SuspendedSenderSupervisorActor.cs | 0 .../TaskActorProtocolTest.cs | 0 .../TaskExtensionsTest.cs | 0 .../TestActorInterfaces.cs | 0 .../TestKit/TestkitTest.cs | 0 .../Vlingo.Xoom.Actors.Tests.csproj} | 2 +- .../WorldDefaultConfigurationTest.cs | 0 .../WorldTest.cs | 0 .../vlingo-actors.json | 0 ...ingo.Actors.sln => Vlingo.Xoom.Actors.sln} | 62 +- ...r => Vlingo.Xoom.Actors.sln.licenseheader} | 2 +- .../Actor.cs | 806 ++++---- .../ActorAddressAlreadyRegisteredException.cs | 0 .../ActorFactory.cs | 470 ++--- .../ActorLoggerAdapter.cs | 0 .../ActorProxy.cs | 0 .../ActorProxyBase.cs | 0 .../ActorProxyStub.cs | 0 .../Addressable__Proxy.cs | 0 .../Backoff.cs | 0 .../BasicAddress.cs | 0 .../BasicAddressFactory.cs | 0 .../BroadcastRouter.cs | 0 .../Cancellable__Proxy.cs | 0 .../Characters.cs | 0 .../CommonSupervisor.cs | 0 .../CompletesEventuallyActor.cs | 0 .../CompletesEventually__Proxy.cs | 0 .../CompletionSupplier.cs | 0 .../CompletionTranslator.cs | 0 .../Configuration.cs | 0 .../ContentBasedRouter.cs | 0 .../DeadLetter.cs | 0 .../DeadLettersActor.cs | 0 .../DeadLettersListener__Proxy.cs | 0 .../DeadLetters__Proxy.cs | 0 .../DefaultSupervisionStrategyImpl.cs | 0 .../DefaultSupervisor.cs | 0 .../DefaultSupervisorImpl.cs | 0 .../Definition.cs | 922 ++++----- .../Directory.cs | 0 .../DirectoryEvictor.cs | 0 .../DirectoryScannerActor.cs | 0 .../DirectoryScanner__Proxy.cs | 4 +- .../Environment.cs | 306 +-- .../Evictable.cs | 0 .../ExecutorDispatcherAsync.cs | 0 .../ExpressionExtensions.cs | 0 .../FailureMark.cs | 0 .../GuidAddress.cs | 0 .../GuidAddressFactory.cs | 0 .../IAddress.cs | 0 .../IAddressFactory.cs | 0 .../IAddressable.cs | 0 .../ICompletesEventually.cs | 0 .../ICompletesEventuallyProvider.cs | 0 .../ICompletesEventuallyProviderKeeper.cs | 0 .../IDeadLetters.cs | 0 .../IDeadLettersListener.cs | 0 .../IDirectoryScanner.cs | 0 .../IDispatcher.cs | 0 .../ILogger.cs | 0 .../ILoggerProvider.cs | 0 .../ILoggerProviderKeeper.cs | 0 .../IMailbox.cs | 0 .../IMailboxProvider.cs | 0 .../IMailboxProviderKeeper.cs | 0 .../IMessage.cs | 0 .../INoProtocol.cs | 0 .../IRegistrar.cs | 0 .../IRelocatable.cs | 0 .../ISafeProxyGenerable.cs | 0 .../IStartable.cs | 28 +- .../IStoppable.cs | 90 +- .../ISupervised.cs | 0 .../ISupervisionStrategy.cs | 0 .../ISupervisor.cs | 0 .../InvalidProtocolException.cs | 0 .../LifeCycle.cs | 342 ++-- .../LocalMessage.cs | 0 .../LocalMessageAsync.cs | 0 .../Logger__Proxy.cs | 10 +- .../NoProtocol__Proxy.cs | 0 .../Plugin/AbstractPlugin.cs | 0 .../Completes/CompletesEventuallyPool.cs | 0 ...efaultCompletesEventuallyProviderKeeper.cs | 0 .../Plugin/Completes/PooledCompletesPlugin.cs | 0 .../PooledCompletesPluginConfiguration.cs | 0 .../DirectoryEvictionConfiguration.cs | 0 .../Eviction/DirectoryEvictionPlugin.cs | 0 .../Plugin/IPlugin.cs | 0 .../Plugin/IPluginConfiguration.cs | 0 .../Plugin/Logging/Console/ConsoleLogger.cs | 0 .../Logging/Console/ConsoleLoggerActor.cs | 0 .../Logging/Console/ConsoleLoggerPlugin.cs | 0 .../ConsoleLoggerPluginConfiguration.cs | 0 .../Logging/DefaultLoggerProviderKeeper.cs | 0 .../Plugin/Logging/LogEvent.cs | 0 .../Plugin/Logging/NoOp/NoOpLogger.cs | 0 .../Plugin/Logging/NoOp/NoOpLoggerProvider.cs | 0 ...ManyToOneConcurrentArrayQueueDispatcher.cs | 0 .../ManyToOneConcurrentArrayQueueMailbox.cs | 0 .../ManyToOneConcurrentArrayQueuePlugin.cs | 0 ...ConcurrentArrayQueuePluginConfiguration.cs | 0 .../ConcurrentQueue/ConcurrentQueueMailbox.cs | 0 .../ConcurrentQueueMailboxPlugin.cs | 0 ...ncurrentQueueMailboxPluginConfiguration.cs | 0 .../ConcurrentQueue/ExecutorDispatcher.cs | 0 .../ConcurrentQueue/ThreadPoolExecutor.cs | 0 .../Mailbox/DefaultMailboxProviderKeeper.cs | 0 .../DefaultMailboxProviderKeeperPlugin.cs | 0 ...ailboxProviderKeeperPluginConfiguration.cs | 0 .../SharedRingBuffer/RingBufferDispatcher.cs | 0 .../SharedRingBufferMailbox.cs | 0 .../SharedRingBufferMailboxPlugin.cs | 0 ...redRingBufferMailboxPluginConfiguration.cs | 0 .../Plugin/Mailbox/TestKit/TestMailbox.cs | 0 .../Mailbox/TestKit/TestMailboxPlugin.cs | 0 .../Plugin/PluginLoader.cs | 0 .../Plugin/PluginProperties.cs | 0 .../Supervision/CommonSupervisorsPlugin.cs | 0 .../CommonSupervisorsPluginConfiguration.cs | 0 .../Supervision/ConfiguredSupervisor.cs | 0 .../Supervision/DefaultSupervisorOverride.cs | 0 .../DefaultSupervisorOverridePlugin.cs | 0 ...ltSupervisorOverridePluginConfiguration.cs | 2 +- .../Plugin/Supervision/DefinitionValues.cs | 0 .../PooledCompletes.cs | 0 .../PrivateRootActor.cs | 0 .../Properties.cs | 0 .../Protocols.cs | 0 .../ProxyGenerator.cs | 0 .../PubSub/AffectedSubscriptions.cs | 0 .../PubSub/Condition.cs | 0 .../PubSub/DefaultPublisher.cs | 0 .../PubSub/IMessage.cs | 0 .../PubSub/IPublisher.cs | 0 .../PubSub/ISubscriber.cs | 0 .../PubSub/Operation.cs | 0 .../PubSub/Subscriptions.cs | 0 .../PubSub/Topic.cs | 0 .../PublicRootActor.cs | 0 .../RandomRouter.cs | 0 .../ResultCompletes.cs | 0 .../ResumingMailbox.cs | 0 .../RoundRobinRouter.cs | 0 .../Routee.cs | 0 .../Router.cs | 0 .../RouterSpecification.cs | 0 .../Routing.cs | 0 .../Scheduled__Proxy.cs | 0 .../SmallestMailboxRouter.cs | 0 .../Stage.cs | 1728 ++++++++--------- .../StageSupervisedActor.cs | 0 .../Startable__Proxy.cs | 0 .../Stoppable__Proxy.cs | 0 .../Stowage.cs | 242 +-- .../StowedLocalMessage.cs | 0 .../SupervisionStrategyConstants.cs | 0 .../Supervisor__Proxy.cs | 0 .../TaskExtensions.cs | 0 .../TestKit/AccessSafely.cs | 0 .../TestKit/ITestStateView.cs | 0 .../TestKit/TestActor.cs | 0 .../TestKit/TestContext.cs | 0 .../TestKit/TestEnvironment.cs | 0 .../TestKit/TestState.cs | 0 .../TestKit/TestUntil.cs | 0 .../TestKit/TestWorld.cs | 0 .../Vlingo.Xoom.Actors.csproj} | 7 +- .../World.cs | 4 +- .../vlingo-actors.json | 0 vlingo-64x64.png | Bin 2585 -> 3107 bytes 251 files changed, 2542 insertions(+), 2543 deletions(-) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ActorEnvironmentTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ActorFactoryTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ActorLifecycleTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ActorMessageSendingSpeedTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ActorProxyBaseTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ActorStopTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ActorStowDisperseTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ActorSuspendResumeTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ActorsTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/AddressTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/AnswerEventuallyTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/BroadcastRouterTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/CharactersTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/CompletesActorProtocolTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ConfigurationTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ContentBasedRouterTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Converter.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/DeadLettersTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/DefinitionTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/DirectoryTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/DispatcherTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/GenericWithConstraints__Proxy.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/GuidAddressTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/InterruptableActorTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/LocalMessageTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/MockCompletes.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Completes/MockCompletesEventually.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Completes/MockCompletesEventuallyProvider.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Completes/MockCompletesPlugin.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Completes/MockRegistrar.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Completes/PooledCompletesPluginTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Completes/PooledCompletesProviderTest.cs (95%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Logging/ConsoleLoggerTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcherTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailboxActorTest.cs (97%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcherTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/DefaultMailboxProviderKeeperTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/ICountTaker.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/SharedRingBuffer/PropertiesFileConfigRingBufferMailboxActorTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcherTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/Mailbox/SharedRingBuffer/RingBufferMailboxActorTest.cs (98%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Plugin/PluginPropertiesTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ProtocolsTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ProxyGeneratorTests.cs (79%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ProxyLookupTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/RandomRouterTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/ReusableQueueMailboxTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/RoundRobinRouterTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/SchedulerTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/SmallestMailboxRouterTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/StageNamedTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/StageSupervisedActorTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/StageTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/StowageTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/BasicSupervisionTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/CommonSupervisionTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/DefaultSupervisorOverrideTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/EscalateSupervisorActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/FailureControlActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/IFailureControl.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/IFailureControlSender.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/IPing.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/IPong.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/PingActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/PingSupervisorActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/PongActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/PongSupervisorActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/RestartFiveInOneSupervisorActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/RestartForeverSupervisorActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/ResumeForeverSupervisorActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/StopAllSupervisorActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/SupervisionStrategyTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/Supervision/SuspendedSenderSupervisorActor.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/TaskActorProtocolTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/TaskExtensionsTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/TestActorInterfaces.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/TestKit/TestkitTest.cs (100%) rename src/{Vlingo.Actors.Tests/Vlingo.Actors.Tests.csproj => Vlingo.Xoom.Actors.Tests/Vlingo.Xoom.Actors.Tests.csproj} (92%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/WorldDefaultConfigurationTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/WorldTest.cs (100%) rename src/{Vlingo.Actors.Tests => Vlingo.Xoom.Actors.Tests}/vlingo-actors.json (100%) rename src/{Vlingo.Actors.sln => Vlingo.Xoom.Actors.sln} (79%) rename src/{Vlingo.Actors.sln.licenseheader => Vlingo.Xoom.Actors.sln.licenseheader} (78%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Actor.cs (97%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ActorAddressAlreadyRegisteredException.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ActorFactory.cs (96%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ActorLoggerAdapter.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ActorProxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ActorProxyBase.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ActorProxyStub.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Addressable__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Backoff.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/BasicAddress.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/BasicAddressFactory.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/BroadcastRouter.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Cancellable__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Characters.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/CommonSupervisor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/CompletesEventuallyActor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/CompletesEventually__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/CompletionSupplier.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/CompletionTranslator.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Configuration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ContentBasedRouter.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DeadLetter.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DeadLettersActor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DeadLettersListener__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DeadLetters__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DefaultSupervisionStrategyImpl.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DefaultSupervisor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DefaultSupervisorImpl.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Definition.cs (97%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Directory.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DirectoryEvictor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DirectoryScannerActor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/DirectoryScanner__Proxy.cs (97%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Environment.cs (97%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Evictable.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ExecutorDispatcherAsync.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ExpressionExtensions.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/FailureMark.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/GuidAddress.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/GuidAddressFactory.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IAddress.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IAddressFactory.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IAddressable.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ICompletesEventually.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ICompletesEventuallyProvider.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ICompletesEventuallyProviderKeeper.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IDeadLetters.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IDeadLettersListener.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IDirectoryScanner.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IDispatcher.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ILogger.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ILoggerProvider.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ILoggerProviderKeeper.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IMailbox.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IMailboxProvider.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IMailboxProviderKeeper.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IMessage.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/INoProtocol.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IRegistrar.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IRelocatable.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ISafeProxyGenerable.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IStartable.cs (96%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/IStoppable.cs (97%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ISupervised.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ISupervisionStrategy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ISupervisor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/InvalidProtocolException.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/LifeCycle.cs (96%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/LocalMessage.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/LocalMessageAsync.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Logger__Proxy.cs (99%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/NoProtocol__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/AbstractPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Completes/CompletesEventuallyPool.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Completes/DefaultCompletesEventuallyProviderKeeper.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Completes/PooledCompletesPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Completes/PooledCompletesPluginConfiguration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Eviction/DirectoryEvictionConfiguration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Eviction/DirectoryEvictionPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/IPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/IPluginConfiguration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Logging/Console/ConsoleLogger.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Logging/Console/ConsoleLoggerActor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Logging/Console/ConsoleLoggerPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Logging/Console/ConsoleLoggerPluginConfiguration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Logging/DefaultLoggerProviderKeeper.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Logging/LogEvent.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Logging/NoOp/NoOpLogger.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Logging/NoOp/NoOpLoggerProvider.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcher.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailbox.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePluginConfiguration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailbox.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPluginConfiguration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcher.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/ConcurrentQueue/ThreadPoolExecutor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/DefaultMailboxProviderKeeper.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/DefaultMailboxProviderKeeperPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginConfiguration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcher.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailbox.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPluginConfiguration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/TestKit/TestMailbox.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Mailbox/TestKit/TestMailboxPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/PluginLoader.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/PluginProperties.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Supervision/CommonSupervisorsPlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Supervision/CommonSupervisorsPluginConfiguration.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Supervision/ConfiguredSupervisor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Supervision/DefaultSupervisorOverride.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Supervision/DefaultSupervisorOverridePlugin.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Supervision/DefaultSupervisorOverridePluginConfiguration.cs (94%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Plugin/Supervision/DefinitionValues.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PooledCompletes.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PrivateRootActor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Properties.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Protocols.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ProxyGenerator.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PubSub/AffectedSubscriptions.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PubSub/Condition.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PubSub/DefaultPublisher.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PubSub/IMessage.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PubSub/IPublisher.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PubSub/ISubscriber.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PubSub/Operation.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PubSub/Subscriptions.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PubSub/Topic.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/PublicRootActor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/RandomRouter.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ResultCompletes.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/ResumingMailbox.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/RoundRobinRouter.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Routee.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Router.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/RouterSpecification.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Routing.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Scheduled__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/SmallestMailboxRouter.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Stage.cs (97%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/StageSupervisedActor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Startable__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Stoppable__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Stowage.cs (96%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/StowedLocalMessage.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/SupervisionStrategyConstants.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/Supervisor__Proxy.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/TaskExtensions.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/TestKit/AccessSafely.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/TestKit/ITestStateView.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/TestKit/TestActor.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/TestKit/TestContext.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/TestKit/TestEnvironment.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/TestKit/TestState.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/TestKit/TestUntil.cs (100%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/TestKit/TestWorld.cs (100%) rename src/{Vlingo.Actors/Vlingo.Actors.csproj => Vlingo.Xoom.Actors/Vlingo.Xoom.Actors.csproj} (86%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/World.cs (99%) rename src/{Vlingo.Actors => Vlingo.Xoom.Actors}/vlingo-actors.json (100%) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c89c5584..174121f6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -23,13 +23,13 @@ jobs: dotnet-version: 3.1.402 - name: Restore dependencies id: restore-deps - run: dotnet restore ./src/Vlingo.Actors.sln + run: dotnet restore ./src/Vlingo.Xoom.Actors.sln - name: Build id: build - run: dotnet build ./src/Vlingo.Actors.sln --no-restore + run: dotnet build ./src/Vlingo.Xoom.Actors.sln --no-restore - name: Test id: test - run: dotnet test ./src/Vlingo.Actors.Tests/Vlingo.Actors.Tests.csproj --no-build --verbosity normal + run: dotnet test ./src/Vlingo.Xoom.Actors.Tests/Vlingo.Xoom.Actors.Tests.csproj --no-build --verbosity normal - name: slack - GitHub Actions Slack integration uses: act10ns/slack@v1.2.2 env: diff --git a/Directory.Build.props b/Directory.Build.props index a3bdaa36..67cdd282 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.6.3 + 1.7.0 diff --git a/README.md b/README.md index f31d9023..4a425425 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -# vlingo-actors +# xoom-net-actors -[![Build status](https://ci.appveyor.com/api/projects/status/o1ajhxlf9i2q6gs7/branch/master?svg=true)](https://ci.appveyor.com/project/VlingoNetOwner/vlingo-net-actors/branch/master) -![Build master](https://github.com/vlingo-net/vlingo-net-actors/workflows/.NET/badge.svg) -[![NuGet](https://img.shields.io/nuget/v/Vlingo.Actors.svg)](https://www.nuget.org/packages/Vlingo.Actors) +[![Build status](https://ci.appveyor.com/api/projects/status/o1ajhxlf9i2q6gs7/branch/master?svg=true)](https://ci.appveyor.com/project/VlingoNetOwner/xoom-net-actors/branch/master) +![Build master](https://github.com/vlingo-net/xoom-net-actors/workflows/.NET/badge.svg) +[![NuGet](https://img.shields.io/nuget/v/Vlingo.Xoom.Actors.svg)](https://www.nuget.org/packages/Vlingo.Xoom.Actors) [![Gitter](https://badges.gitter.im/vlingo-platform-net/community.svg)](https://gitter.im/vlingo-platform-net/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) Type safe Actor Model toolkit for reactive concurrency and resiliency using C# and other .NET languages. -The vlingo-actors toolkit is nearly full featured, so don't be fooled by the seemingly low version number. +The xoom-net-actors toolkit is nearly full featured, so don't be fooled by the seemingly low version number. License (See LICENSE file for full license) ------------------------------------------- -Copyright © 2012-2018 VLINGO LABS. All rights reserved. +Copyright © 2012-2021 VLINGO LABS. All rights reserved. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL diff --git a/appveyor.yml b/appveyor.yml index 0c137876..454dbb2c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,13 +8,13 @@ configuration: Release skip_commits: message: /.*\[ci\-skip\].*/ before_build: -- dotnet restore src/Vlingo.Actors.sln +- dotnet restore src/Vlingo.Xoom.Actors.sln build: - project: src/Vlingo.Actors.sln + project: src/Vlingo.Xoom.Actors.sln verbosity: minimal publish_nuget: true test_script: -- dotnet test src/Vlingo.Actors.Tests +- dotnet test src/Vlingo.Xoom.Actors.Tests deploy: - provider: NuGet api_key: diff --git a/src/Vlingo.Actors.Tests/ActorEnvironmentTest.cs b/src/Vlingo.Xoom.Actors.Tests/ActorEnvironmentTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ActorEnvironmentTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ActorEnvironmentTest.cs diff --git a/src/Vlingo.Actors.Tests/ActorFactoryTest.cs b/src/Vlingo.Xoom.Actors.Tests/ActorFactoryTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ActorFactoryTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ActorFactoryTest.cs diff --git a/src/Vlingo.Actors.Tests/ActorLifecycleTest.cs b/src/Vlingo.Xoom.Actors.Tests/ActorLifecycleTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ActorLifecycleTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ActorLifecycleTest.cs diff --git a/src/Vlingo.Actors.Tests/ActorMessageSendingSpeedTest.cs b/src/Vlingo.Xoom.Actors.Tests/ActorMessageSendingSpeedTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ActorMessageSendingSpeedTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ActorMessageSendingSpeedTest.cs diff --git a/src/Vlingo.Actors.Tests/ActorProxyBaseTest.cs b/src/Vlingo.Xoom.Actors.Tests/ActorProxyBaseTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ActorProxyBaseTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ActorProxyBaseTest.cs diff --git a/src/Vlingo.Actors.Tests/ActorStopTest.cs b/src/Vlingo.Xoom.Actors.Tests/ActorStopTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ActorStopTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ActorStopTest.cs diff --git a/src/Vlingo.Actors.Tests/ActorStowDisperseTest.cs b/src/Vlingo.Xoom.Actors.Tests/ActorStowDisperseTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ActorStowDisperseTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ActorStowDisperseTest.cs diff --git a/src/Vlingo.Actors.Tests/ActorSuspendResumeTest.cs b/src/Vlingo.Xoom.Actors.Tests/ActorSuspendResumeTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ActorSuspendResumeTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ActorSuspendResumeTest.cs diff --git a/src/Vlingo.Actors.Tests/ActorsTest.cs b/src/Vlingo.Xoom.Actors.Tests/ActorsTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ActorsTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ActorsTest.cs diff --git a/src/Vlingo.Actors.Tests/AddressTest.cs b/src/Vlingo.Xoom.Actors.Tests/AddressTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/AddressTest.cs rename to src/Vlingo.Xoom.Actors.Tests/AddressTest.cs diff --git a/src/Vlingo.Actors.Tests/AnswerEventuallyTest.cs b/src/Vlingo.Xoom.Actors.Tests/AnswerEventuallyTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/AnswerEventuallyTest.cs rename to src/Vlingo.Xoom.Actors.Tests/AnswerEventuallyTest.cs diff --git a/src/Vlingo.Actors.Tests/BroadcastRouterTest.cs b/src/Vlingo.Xoom.Actors.Tests/BroadcastRouterTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/BroadcastRouterTest.cs rename to src/Vlingo.Xoom.Actors.Tests/BroadcastRouterTest.cs diff --git a/src/Vlingo.Actors.Tests/CharactersTest.cs b/src/Vlingo.Xoom.Actors.Tests/CharactersTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/CharactersTest.cs rename to src/Vlingo.Xoom.Actors.Tests/CharactersTest.cs diff --git a/src/Vlingo.Actors.Tests/CompletesActorProtocolTest.cs b/src/Vlingo.Xoom.Actors.Tests/CompletesActorProtocolTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/CompletesActorProtocolTest.cs rename to src/Vlingo.Xoom.Actors.Tests/CompletesActorProtocolTest.cs diff --git a/src/Vlingo.Actors.Tests/ConfigurationTest.cs b/src/Vlingo.Xoom.Actors.Tests/ConfigurationTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ConfigurationTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ConfigurationTest.cs diff --git a/src/Vlingo.Actors.Tests/ContentBasedRouterTest.cs b/src/Vlingo.Xoom.Actors.Tests/ContentBasedRouterTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ContentBasedRouterTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ContentBasedRouterTest.cs diff --git a/src/Vlingo.Actors.Tests/Converter.cs b/src/Vlingo.Xoom.Actors.Tests/Converter.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Converter.cs rename to src/Vlingo.Xoom.Actors.Tests/Converter.cs diff --git a/src/Vlingo.Actors.Tests/DeadLettersTest.cs b/src/Vlingo.Xoom.Actors.Tests/DeadLettersTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/DeadLettersTest.cs rename to src/Vlingo.Xoom.Actors.Tests/DeadLettersTest.cs diff --git a/src/Vlingo.Actors.Tests/DefinitionTest.cs b/src/Vlingo.Xoom.Actors.Tests/DefinitionTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/DefinitionTest.cs rename to src/Vlingo.Xoom.Actors.Tests/DefinitionTest.cs diff --git a/src/Vlingo.Actors.Tests/DirectoryTest.cs b/src/Vlingo.Xoom.Actors.Tests/DirectoryTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/DirectoryTest.cs rename to src/Vlingo.Xoom.Actors.Tests/DirectoryTest.cs diff --git a/src/Vlingo.Actors.Tests/DispatcherTest.cs b/src/Vlingo.Xoom.Actors.Tests/DispatcherTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/DispatcherTest.cs rename to src/Vlingo.Xoom.Actors.Tests/DispatcherTest.cs diff --git a/src/Vlingo.Actors.Tests/GenericWithConstraints__Proxy.cs b/src/Vlingo.Xoom.Actors.Tests/GenericWithConstraints__Proxy.cs similarity index 100% rename from src/Vlingo.Actors.Tests/GenericWithConstraints__Proxy.cs rename to src/Vlingo.Xoom.Actors.Tests/GenericWithConstraints__Proxy.cs diff --git a/src/Vlingo.Actors.Tests/GuidAddressTest.cs b/src/Vlingo.Xoom.Actors.Tests/GuidAddressTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/GuidAddressTest.cs rename to src/Vlingo.Xoom.Actors.Tests/GuidAddressTest.cs diff --git a/src/Vlingo.Actors.Tests/InterruptableActorTest.cs b/src/Vlingo.Xoom.Actors.Tests/InterruptableActorTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/InterruptableActorTest.cs rename to src/Vlingo.Xoom.Actors.Tests/InterruptableActorTest.cs diff --git a/src/Vlingo.Actors.Tests/LocalMessageTest.cs b/src/Vlingo.Xoom.Actors.Tests/LocalMessageTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/LocalMessageTest.cs rename to src/Vlingo.Xoom.Actors.Tests/LocalMessageTest.cs diff --git a/src/Vlingo.Actors.Tests/MockCompletes.cs b/src/Vlingo.Xoom.Actors.Tests/MockCompletes.cs similarity index 100% rename from src/Vlingo.Actors.Tests/MockCompletes.cs rename to src/Vlingo.Xoom.Actors.Tests/MockCompletes.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Completes/MockCompletesEventually.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/MockCompletesEventually.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Completes/MockCompletesEventually.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/MockCompletesEventually.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Completes/MockCompletesEventuallyProvider.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/MockCompletesEventuallyProvider.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Completes/MockCompletesEventuallyProvider.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/MockCompletesEventuallyProvider.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Completes/MockCompletesPlugin.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/MockCompletesPlugin.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Completes/MockCompletesPlugin.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/MockCompletesPlugin.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Completes/MockRegistrar.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/MockRegistrar.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Completes/MockRegistrar.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/MockRegistrar.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Completes/PooledCompletesPluginTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/PooledCompletesPluginTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Completes/PooledCompletesPluginTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/PooledCompletesPluginTest.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Completes/PooledCompletesProviderTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/PooledCompletesProviderTest.cs similarity index 95% rename from src/Vlingo.Actors.Tests/Plugin/Completes/PooledCompletesProviderTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/PooledCompletesProviderTest.cs index 583327ce..ce9aec82 100644 --- a/src/Vlingo.Actors.Tests/Plugin/Completes/PooledCompletesProviderTest.cs +++ b/src/Vlingo.Xoom.Actors.Tests/Plugin/Completes/PooledCompletesProviderTest.cs @@ -20,7 +20,7 @@ public void TestActuallyCompletes() { var properties = new Properties(); properties.SetProperty("plugin.name.pooledCompletes", "true"); - properties.SetProperty("plugin.pooledCompletes.classname", "Vlingo.Actors.Plugin.Completes.PooledCompletesPlugin"); + properties.SetProperty("plugin.pooledCompletes.classname", "Vlingo.Xoom.Actors.Plugin.Completes.PooledCompletesPlugin"); properties.SetProperty("plugin.pooledCompletes.pool", "10"); var pluginProperties = new PluginProperties("pooledCompletes", properties); @@ -43,7 +43,7 @@ public void TestCompletesAddressMatches() { var properties = new Properties(); properties.SetProperty("plugin.name.pooledCompletes", "true"); - properties.SetProperty("plugin.pooledCompletes.classname", "Vlingo.Actors.Plugin.Completes.PooledCompletesPlugin"); + properties.SetProperty("plugin.pooledCompletes.classname", "Vlingo.Xoom.Actors.Plugin.Completes.PooledCompletesPlugin"); properties.SetProperty("plugin.pooledCompletes.pool", "10"); var pluginProperties = new PluginProperties("pooledCompletes", properties); diff --git a/src/Vlingo.Actors.Tests/Plugin/Logging/ConsoleLoggerTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Logging/ConsoleLoggerTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Logging/ConsoleLoggerTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Logging/ConsoleLoggerTest.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcherTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcherTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcherTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcherTest.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailboxActorTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailboxActorTest.cs similarity index 97% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailboxActorTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailboxActorTest.cs index 6a030da1..b4848e26 100644 --- a/src/Vlingo.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailboxActorTest.cs +++ b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailboxActorTest.cs @@ -23,7 +23,7 @@ public ManyToOneConcurrentArrayQueueMailboxActorTest() { var properties = new Properties(); properties.SetProperty("plugin.name.testArrayQueueMailbox", "true"); - properties.SetProperty("plugin.testArrayQueueMailbox.classname", "Vlingo.Actors.Plugin.Mailbox.AgronaMPSCArrayQueue.ManyToOneConcurrentArrayQueuePlugin"); + properties.SetProperty("plugin.testArrayQueueMailbox.classname", "Vlingo.Xoom.Actors.Plugin.Mailbox.AgronaMPSCArrayQueue.ManyToOneConcurrentArrayQueuePlugin"); properties.SetProperty("plugin.testArrayQueueMailbox.defaultMailbox", "false"); properties.SetProperty("plugin.testArrayQueueMailbox.size", "" + MailboxSize); properties.SetProperty("plugin.testArrayQueueMailbox.fixedBackoff", "2"); diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxTest.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcherTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcherTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcherTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcherTest.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginTest.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/DefaultMailboxProviderKeeperTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/DefaultMailboxProviderKeeperTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/DefaultMailboxProviderKeeperTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/DefaultMailboxProviderKeeperTest.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/ICountTaker.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/ICountTaker.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/ICountTaker.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/ICountTaker.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/PropertiesFileConfigRingBufferMailboxActorTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/PropertiesFileConfigRingBufferMailboxActorTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/PropertiesFileConfigRingBufferMailboxActorTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/PropertiesFileConfigRingBufferMailboxActorTest.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcherTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcherTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcherTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcherTest.cs diff --git a/src/Vlingo.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferMailboxActorTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferMailboxActorTest.cs similarity index 98% rename from src/Vlingo.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferMailboxActorTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferMailboxActorTest.cs index 58c9a3ae..0dc12b7b 100644 --- a/src/Vlingo.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferMailboxActorTest.cs +++ b/src/Vlingo.Xoom.Actors.Tests/Plugin/Mailbox/SharedRingBuffer/RingBufferMailboxActorTest.cs @@ -93,7 +93,7 @@ private void Init(int mailboxSize) { var properties = new Properties(); properties.SetProperty("plugin.name.testRingMailbox", "true"); - properties.SetProperty("plugin.testRingMailbox.classname", "Vlingo.Actors.Plugin.Mailbox.SharedRingBuffer.SharedRingBufferMailboxPlugin"); + properties.SetProperty("plugin.testRingMailbox.classname", "Vlingo.Xoom.Actors.Plugin.Mailbox.SharedRingBuffer.SharedRingBufferMailboxPlugin"); properties.SetProperty("plugin.testRingMailbox.defaultMailbox", "false"); properties.SetProperty("plugin.testRingMailbox.size", $"{mailboxSize}"); properties.SetProperty("plugin.testRingMailbox.fixedBackoff", "2"); diff --git a/src/Vlingo.Actors.Tests/Plugin/PluginPropertiesTest.cs b/src/Vlingo.Xoom.Actors.Tests/Plugin/PluginPropertiesTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Plugin/PluginPropertiesTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Plugin/PluginPropertiesTest.cs diff --git a/src/Vlingo.Actors.Tests/ProtocolsTest.cs b/src/Vlingo.Xoom.Actors.Tests/ProtocolsTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ProtocolsTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ProtocolsTest.cs diff --git a/src/Vlingo.Actors.Tests/ProxyGeneratorTests.cs b/src/Vlingo.Xoom.Actors.Tests/ProxyGeneratorTests.cs similarity index 79% rename from src/Vlingo.Actors.Tests/ProxyGeneratorTests.cs rename to src/Vlingo.Xoom.Actors.Tests/ProxyGeneratorTests.cs index c894efb5..cabd8d66 100644 --- a/src/Vlingo.Actors.Tests/ProxyGeneratorTests.cs +++ b/src/Vlingo.Xoom.Actors.Tests/ProxyGeneratorTests.cs @@ -22,7 +22,7 @@ public void ShouldIncludeNamespacesForMethodParameters() var result = generator.GenerateFor(typeof(IProxyGenTestInterface)); Assert.Contains("private const string DoSomethingRepresentation1 = \"DoSomething(System.Threading.Tasks.Task)\";", result.Source); Assert.Contains("System.Threading.Tasks.Task t", result.Source); - Assert.Contains($"Action {_consumerName} = __ => __.DoSomething(t);", result.Source); + Assert.Contains($"Action {_consumerName} = __ => __.DoSomething(t);", result.Source); } [Fact] @@ -32,7 +32,7 @@ public void ShouldNotIncludeGenericConstraintForMethod() var result = generator.GenerateFor(typeof(IProxyGenericMethodWithoutConstraint)); Assert.Contains("private const string WriteRepresentation1 = \"Write(string, int)\";", result.Source); Assert.Contains("public void Write(string id, int state)", result.Source); - Assert.Contains($"Action {_consumerName} = __ => __.Write(id, state);", result.Source); + Assert.Contains($"Action {_consumerName} = __ => __.Write(id, state);", result.Source); } [Fact] @@ -42,7 +42,7 @@ public void ShouldCorrectlyGenerateParameterNameWithReservedKeywords() var result = generator.GenerateFor(typeof(IProxyGenTestReservedInterface)); Assert.Contains("private const string DoSomethingRepresentation1 = \"DoSomething(object)\";", result.Source); Assert.Contains("public void DoSomething(object @object)", result.Source); - Assert.Contains($"Action {_consumerName} = __ => __.DoSomething(@object);", result.Source); + Assert.Contains($"Action {_consumerName} = __ => __.DoSomething(@object);", result.Source); } [Fact] @@ -52,7 +52,7 @@ public void ShouldCorrectlyGenerateParameterNameWithReservedKeywordsAddtional() var result = generator.GenerateFor(typeof(IProxyGenTestReservedKeyword)); Assert.Contains("private const string DoSomethingRepresentation1 = \"DoSomething(object, bool)\";", result.Source); Assert.Contains("public void DoSomething(object @object, bool @event)", result.Source); - Assert.Contains($"Action {_consumerName} = __ => __.DoSomething(@object, @event);", result.Source); + Assert.Contains($"Action {_consumerName} = __ => __.DoSomething(@object, @event);", result.Source); } [Fact] @@ -61,8 +61,8 @@ public void ShouldIncludeGenericConstraintForMethod() var generator = ProxyGenerator.ForTest(false, World.DefaultLogger); var result = generator.GenerateFor(typeof(IProxyGenericMethodWithConstraint)); Assert.Contains("private const string WriteRepresentation1 = \"Write(string, int)\";", result.Source); - Assert.Contains("public void Write(string id, int state) where TSource : Vlingo.Actors.Tests.IProxyGenTestInterface", result.Source); - Assert.Contains($"Action {_consumerName} = __ => __.Write(id, state);", result.Source); + Assert.Contains("public void Write(string id, int state) where TSource : Vlingo.Xoom.Actors.Tests.IProxyGenTestInterface", result.Source); + Assert.Contains($"Action {_consumerName} = __ => __.Write(id, state);", result.Source); } [Fact] @@ -71,8 +71,8 @@ public void ShouldIncludeMultipleGenericConstraintForMethod() var generator = ProxyGenerator.ForTest(false, World.DefaultLogger); var result = generator.GenerateFor(typeof(IProxyGenericMethodWithMultipleConstraint)); Assert.Contains("private const string WriteRepresentation1 = \"Write(string, int)\";", result.Source); - Assert.Contains("public void Write(string id, int state) where TSource : Vlingo.Actors.Tests.IProxyGenTestInterface, Vlingo.Actors.Tests.IProxyGenTestSecondInterface", result.Source); - Assert.Contains($"Action {_consumerName} = __ => __.Write(id, state);", result.Source); + Assert.Contains("public void Write(string id, int state) where TSource : Vlingo.Xoom.Actors.Tests.IProxyGenTestInterface, Vlingo.Xoom.Actors.Tests.IProxyGenTestSecondInterface", result.Source); + Assert.Contains($"Action {_consumerName} = __ => __.Write(id, state);", result.Source); } [Fact] @@ -81,8 +81,8 @@ public void ShouldCreateAProxyWithInnerInterface() var generator = ProxyGenerator.ForTest(false, World.DefaultLogger); var result = generator.GenerateFor(typeof(ClassWithNestedInterface.INestedInterface)); Assert.Contains("private const string DoSomethingRepresentation1 = \"DoSomething()\";", result.Source); - Assert.Contains("public class NestedInterface__Proxy : Vlingo.Actors.Tests.ClassWithNestedInterface.INestedInterface", result.Source); - Assert.Contains($"Action {_consumerName} = __ => __.DoSomething();", result.Source); + Assert.Contains("public class NestedInterface__Proxy : Vlingo.Xoom.Actors.Tests.ClassWithNestedInterface.INestedInterface", result.Source); + Assert.Contains($"Action {_consumerName} = __ => __.DoSomething();", result.Source); } [Fact] @@ -90,8 +90,8 @@ public void ShouldCreateAProxyWithReferenceToInnerInterface() { var generator = ProxyGenerator.ForTest(false, World.DefaultLogger); var result = generator.GenerateFor(typeof(IOuterInnerClassInterface)); - Assert.Contains("public class OuterInnerClassInterface__Proxy : Vlingo.Actors.Tests.IOuterInnerClassInterface", result.Source); - Assert.Contains("public void DoSomethingWith(Vlingo.Actors.Tests.OuterClass.InnerClass obj)", result.Source); + Assert.Contains("public class OuterInnerClassInterface__Proxy : Vlingo.Xoom.Actors.Tests.IOuterInnerClassInterface", result.Source); + Assert.Contains("public void DoSomethingWith(Vlingo.Xoom.Actors.Tests.OuterClass.InnerClass obj)", result.Source); } public ProxyGeneratorTests() => ProxyGenerator.Seed = 222; diff --git a/src/Vlingo.Actors.Tests/ProxyLookupTest.cs b/src/Vlingo.Xoom.Actors.Tests/ProxyLookupTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ProxyLookupTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ProxyLookupTest.cs diff --git a/src/Vlingo.Actors.Tests/RandomRouterTest.cs b/src/Vlingo.Xoom.Actors.Tests/RandomRouterTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/RandomRouterTest.cs rename to src/Vlingo.Xoom.Actors.Tests/RandomRouterTest.cs diff --git a/src/Vlingo.Actors.Tests/ReusableQueueMailboxTest.cs b/src/Vlingo.Xoom.Actors.Tests/ReusableQueueMailboxTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/ReusableQueueMailboxTest.cs rename to src/Vlingo.Xoom.Actors.Tests/ReusableQueueMailboxTest.cs diff --git a/src/Vlingo.Actors.Tests/RoundRobinRouterTest.cs b/src/Vlingo.Xoom.Actors.Tests/RoundRobinRouterTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/RoundRobinRouterTest.cs rename to src/Vlingo.Xoom.Actors.Tests/RoundRobinRouterTest.cs diff --git a/src/Vlingo.Actors.Tests/SchedulerTest.cs b/src/Vlingo.Xoom.Actors.Tests/SchedulerTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/SchedulerTest.cs rename to src/Vlingo.Xoom.Actors.Tests/SchedulerTest.cs diff --git a/src/Vlingo.Actors.Tests/SmallestMailboxRouterTest.cs b/src/Vlingo.Xoom.Actors.Tests/SmallestMailboxRouterTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/SmallestMailboxRouterTest.cs rename to src/Vlingo.Xoom.Actors.Tests/SmallestMailboxRouterTest.cs diff --git a/src/Vlingo.Actors.Tests/StageNamedTest.cs b/src/Vlingo.Xoom.Actors.Tests/StageNamedTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/StageNamedTest.cs rename to src/Vlingo.Xoom.Actors.Tests/StageNamedTest.cs diff --git a/src/Vlingo.Actors.Tests/StageSupervisedActorTest.cs b/src/Vlingo.Xoom.Actors.Tests/StageSupervisedActorTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/StageSupervisedActorTest.cs rename to src/Vlingo.Xoom.Actors.Tests/StageSupervisedActorTest.cs diff --git a/src/Vlingo.Actors.Tests/StageTest.cs b/src/Vlingo.Xoom.Actors.Tests/StageTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/StageTest.cs rename to src/Vlingo.Xoom.Actors.Tests/StageTest.cs diff --git a/src/Vlingo.Actors.Tests/StowageTest.cs b/src/Vlingo.Xoom.Actors.Tests/StowageTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/StowageTest.cs rename to src/Vlingo.Xoom.Actors.Tests/StowageTest.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/BasicSupervisionTest.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/BasicSupervisionTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/BasicSupervisionTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/BasicSupervisionTest.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/CommonSupervisionTest.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/CommonSupervisionTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/CommonSupervisionTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/CommonSupervisionTest.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/DefaultSupervisorOverrideTest.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/DefaultSupervisorOverrideTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/DefaultSupervisorOverrideTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/DefaultSupervisorOverrideTest.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/EscalateSupervisorActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/EscalateSupervisorActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/EscalateSupervisorActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/EscalateSupervisorActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/FailureControlActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/FailureControlActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/FailureControlActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/FailureControlActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/IFailureControl.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/IFailureControl.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/IFailureControl.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/IFailureControl.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/IFailureControlSender.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/IFailureControlSender.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/IFailureControlSender.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/IFailureControlSender.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/IPing.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/IPing.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/IPing.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/IPing.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/IPong.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/IPong.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/IPong.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/IPong.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/PingActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/PingActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/PingActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/PingActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/PingSupervisorActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/PingSupervisorActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/PingSupervisorActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/PingSupervisorActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/PongActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/PongActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/PongActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/PongActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/PongSupervisorActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/PongSupervisorActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/PongSupervisorActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/PongSupervisorActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/RestartFiveInOneSupervisorActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/RestartFiveInOneSupervisorActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/RestartFiveInOneSupervisorActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/RestartFiveInOneSupervisorActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/RestartForeverSupervisorActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/RestartForeverSupervisorActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/RestartForeverSupervisorActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/RestartForeverSupervisorActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/ResumeForeverSupervisorActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/ResumeForeverSupervisorActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/ResumeForeverSupervisorActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/ResumeForeverSupervisorActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/StopAllSupervisorActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/StopAllSupervisorActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/StopAllSupervisorActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/StopAllSupervisorActor.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/SupervisionStrategyTest.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/SupervisionStrategyTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/SupervisionStrategyTest.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/SupervisionStrategyTest.cs diff --git a/src/Vlingo.Actors.Tests/Supervision/SuspendedSenderSupervisorActor.cs b/src/Vlingo.Xoom.Actors.Tests/Supervision/SuspendedSenderSupervisorActor.cs similarity index 100% rename from src/Vlingo.Actors.Tests/Supervision/SuspendedSenderSupervisorActor.cs rename to src/Vlingo.Xoom.Actors.Tests/Supervision/SuspendedSenderSupervisorActor.cs diff --git a/src/Vlingo.Actors.Tests/TaskActorProtocolTest.cs b/src/Vlingo.Xoom.Actors.Tests/TaskActorProtocolTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/TaskActorProtocolTest.cs rename to src/Vlingo.Xoom.Actors.Tests/TaskActorProtocolTest.cs diff --git a/src/Vlingo.Actors.Tests/TaskExtensionsTest.cs b/src/Vlingo.Xoom.Actors.Tests/TaskExtensionsTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/TaskExtensionsTest.cs rename to src/Vlingo.Xoom.Actors.Tests/TaskExtensionsTest.cs diff --git a/src/Vlingo.Actors.Tests/TestActorInterfaces.cs b/src/Vlingo.Xoom.Actors.Tests/TestActorInterfaces.cs similarity index 100% rename from src/Vlingo.Actors.Tests/TestActorInterfaces.cs rename to src/Vlingo.Xoom.Actors.Tests/TestActorInterfaces.cs diff --git a/src/Vlingo.Actors.Tests/TestKit/TestkitTest.cs b/src/Vlingo.Xoom.Actors.Tests/TestKit/TestkitTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/TestKit/TestkitTest.cs rename to src/Vlingo.Xoom.Actors.Tests/TestKit/TestkitTest.cs diff --git a/src/Vlingo.Actors.Tests/Vlingo.Actors.Tests.csproj b/src/Vlingo.Xoom.Actors.Tests/Vlingo.Xoom.Actors.Tests.csproj similarity index 92% rename from src/Vlingo.Actors.Tests/Vlingo.Actors.Tests.csproj rename to src/Vlingo.Xoom.Actors.Tests/Vlingo.Xoom.Actors.Tests.csproj index a98f2c26..39938642 100644 --- a/src/Vlingo.Actors.Tests/Vlingo.Actors.Tests.csproj +++ b/src/Vlingo.Xoom.Actors.Tests/Vlingo.Xoom.Actors.Tests.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/Vlingo.Actors.Tests/WorldDefaultConfigurationTest.cs b/src/Vlingo.Xoom.Actors.Tests/WorldDefaultConfigurationTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/WorldDefaultConfigurationTest.cs rename to src/Vlingo.Xoom.Actors.Tests/WorldDefaultConfigurationTest.cs diff --git a/src/Vlingo.Actors.Tests/WorldTest.cs b/src/Vlingo.Xoom.Actors.Tests/WorldTest.cs similarity index 100% rename from src/Vlingo.Actors.Tests/WorldTest.cs rename to src/Vlingo.Xoom.Actors.Tests/WorldTest.cs diff --git a/src/Vlingo.Actors.Tests/vlingo-actors.json b/src/Vlingo.Xoom.Actors.Tests/vlingo-actors.json similarity index 100% rename from src/Vlingo.Actors.Tests/vlingo-actors.json rename to src/Vlingo.Xoom.Actors.Tests/vlingo-actors.json diff --git a/src/Vlingo.Actors.sln b/src/Vlingo.Xoom.Actors.sln similarity index 79% rename from src/Vlingo.Actors.sln rename to src/Vlingo.Xoom.Actors.sln index 65232e77..706ad245 100644 --- a/src/Vlingo.Actors.sln +++ b/src/Vlingo.Xoom.Actors.sln @@ -1,31 +1,31 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2037 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vlingo.Actors", "Vlingo.Actors\Vlingo.Actors.csproj", "{854B3089-2737-4F96-930D-8812DE851903}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vlingo.Actors.Tests", "Vlingo.Actors.Tests\Vlingo.Actors.Tests.csproj", "{1E906E6D-19E3-4943-B3D8-F4E024AE3A03}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {854B3089-2737-4F96-930D-8812DE851903}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {854B3089-2737-4F96-930D-8812DE851903}.Debug|Any CPU.Build.0 = Debug|Any CPU - {854B3089-2737-4F96-930D-8812DE851903}.Release|Any CPU.ActiveCfg = Release|Any CPU - {854B3089-2737-4F96-930D-8812DE851903}.Release|Any CPU.Build.0 = Release|Any CPU - {1E906E6D-19E3-4943-B3D8-F4E024AE3A03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1E906E6D-19E3-4943-B3D8-F4E024AE3A03}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1E906E6D-19E3-4943-B3D8-F4E024AE3A03}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1E906E6D-19E3-4943-B3D8-F4E024AE3A03}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {47F8D8E5-00A9-4484-A985-1E0FF772B43D} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2037 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vlingo.Xoom.Actors", "Vlingo.Xoom.Actors\Vlingo.Xoom.Actors.csproj", "{854B3089-2737-4F96-930D-8812DE851903}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vlingo.Xoom.Actors.Tests", "Vlingo.Xoom.Actors.Tests\Vlingo.Xoom.Actors.Tests.csproj", "{1E906E6D-19E3-4943-B3D8-F4E024AE3A03}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {854B3089-2737-4F96-930D-8812DE851903}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {854B3089-2737-4F96-930D-8812DE851903}.Debug|Any CPU.Build.0 = Debug|Any CPU + {854B3089-2737-4F96-930D-8812DE851903}.Release|Any CPU.ActiveCfg = Release|Any CPU + {854B3089-2737-4F96-930D-8812DE851903}.Release|Any CPU.Build.0 = Release|Any CPU + {1E906E6D-19E3-4943-B3D8-F4E024AE3A03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E906E6D-19E3-4943-B3D8-F4E024AE3A03}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E906E6D-19E3-4943-B3D8-F4E024AE3A03}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E906E6D-19E3-4943-B3D8-F4E024AE3A03}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {47F8D8E5-00A9-4484-A985-1E0FF772B43D} + EndGlobalSection +EndGlobal diff --git a/src/Vlingo.Actors.sln.licenseheader b/src/Vlingo.Xoom.Actors.sln.licenseheader similarity index 78% rename from src/Vlingo.Actors.sln.licenseheader rename to src/Vlingo.Xoom.Actors.sln.licenseheader index bbbe7bac..7f74d23b 100644 --- a/src/Vlingo.Actors.sln.licenseheader +++ b/src/Vlingo.Xoom.Actors.sln.licenseheader @@ -1,5 +1,5 @@ extensions: .cs -// Copyright (c) 2012-2019 VLINGO LABS. All rights reserved. +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. // // This Source Code Form is subject to the terms of the // Mozilla Public License, v. 2.0. If a copy of the MPL diff --git a/src/Vlingo.Actors/Actor.cs b/src/Vlingo.Xoom.Actors/Actor.cs similarity index 97% rename from src/Vlingo.Actors/Actor.cs rename to src/Vlingo.Xoom.Actors/Actor.cs index 58d5bcc9..45f926d2 100644 --- a/src/Vlingo.Actors/Actor.cs +++ b/src/Vlingo.Xoom.Actors/Actor.cs @@ -1,404 +1,404 @@ -// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -using System; -using System.Linq.Expressions; -using System.Reflection; -using Vlingo.Actors.TestKit; -using Vlingo.Xoom.Common; - -namespace Vlingo.Actors -{ - /// - /// The abstract base class of all concrete Actor types. This base provides common - /// facilities and life cycle processing for all Actor types. - /// - public abstract class Actor : IStartable, IStoppable, IRelocatable, ITestStateView - { - internal readonly ResultCompletes CompletesImpl; - internal LifeCycle LifeCycle { get; } - - /// - /// Answers the address of this Actor. - /// - /// Gets the Address of this Actor. - public IAddress Address => LifeCycle.Address; - - /// - /// Answers the DeadLetters for this Actor. - /// - /// Gets the DeadLetters for this Actor. - public virtual IDeadLetters? DeadLetters => LifeCycle.Environment.Stage.World.DeadLetters; - - /// - /// Answers the Scheduler for this Actor. - /// - /// Gets the Scheduler for this Actor. - public virtual Scheduler Scheduler => LifeCycle.Environment.Stage.Scheduler; - - /// - public void StateSnapshot(TS stateSnapshot) - { - // no-op - } - - /// - public TS StateSnapshot() => default!; // no-op - - /// - /// The default implementation of Start(), which is a no-op. Override if needed. - /// - public virtual void Start() - { - } - - /// - /// Answers whether or not this Actor has been stopped or is in the process or stopping. - /// - /// true if this Actor is stopped. false otherwise. - public virtual bool IsStopped => LifeCycle.IsStopped; - - public virtual void Conclude() - => SelfAs().Stop(); - - /// - /// Initiates the process of stopping this Actor and all of its children. - /// - public virtual void Stop() - { - if (!IsStopped) - { - if (LifeCycle.Address.Id != World.DeadLettersId) - { - // TODO: remove this actor as a child on parent - LifeCycle.SuspendForStop(); - LifeCycle.Stop(this); - } - } - } - - /// - /// Received from the surrounding to indicate - /// that it is in use, enabling any special test initialization as - /// ended. This is received (1) with a TestContext when the - /// TestActor is first constructed, and (2) with null - /// before each TestMailbox delivery. - /// - /// The TestContext. - public virtual void ViewTestStateInitialization(TestContext? context) { } - - /// - /// Answers the TestState for this Actor. Override to provide a snapshot of the current Actor state. - /// - /// The TestState of this Actor. - public virtual TestState ViewTestState() => new TestState(); - - /// - /// Answers whether or not this Actor is equal to other. - /// - /// The object to which this Actor is compared - /// true if the two objects are of same type and has the same address. false otherwise. - public override bool Equals(object? other) - { - if (other == null || other.GetType() != GetType()) - { - return false; - } - - return Address.Equals(((Actor)other).LifeCycle.Address); - } - - /// - /// Answers the int hash code of this Actor. - /// - /// The hash code of this Actor. - public override int GetHashCode() => LifeCycle.GetHashCode(); - - /// - /// Answers the string representation of this Actor. - /// - /// The string representation of this Actor - public override string ToString() => $"Actor[type={GetType().Name} address={Address}]"; - - /// - /// Answers the parent Actor of this Actor. (INTERNAL ONLY) - /// - /// Gets the parent Actor. - internal virtual Actor Parent - { - get - { - if (LifeCycle.Environment.IsSecured) - { - throw new InvalidOperationException("A secured actor cannot provide its parent."); - } - - return LifeCycle.Environment.Parent!; - } - } - - /// - /// Initializes the newly created Actor. - /// - protected Actor() - { - var maybeEnvironment = ActorFactory.ThreadLocalEnvironment.Value; - LifeCycle = new LifeCycle(maybeEnvironment ?? new TestEnvironment(), new Evictable(this)); - ActorFactory.ThreadLocalEnvironment.Value = null; - CompletesImpl = new ResultCompletes(); - } - - /// - /// Answer my internal from Completes() after preparing - /// for the to be set in my CompletesEventually(). - /// - /// The the provides an eventual outcome - /// The return type of - /// of type - protected internal ICompletes AnswerFrom(ICompletes eventualOutcome) - { - eventualOutcome.AndThenConsume(value => CompletesEventually().With(value)); - return (ICompletes)Completes(); - } - - /// - /// Answers the protocol for the child Actor to be created by this parent Actor. - /// - /// The protocol type - /// The Definition of the child Actor to be created by this parent Actor - /// A child Actor of type created by this parent Actor. - protected internal virtual T ChildActorFor(Definition definition) - { - if (definition.Supervisor != null) - { - return LifeCycle.Environment.Stage.ActorFor( - definition, - this, - definition.Supervisor, - Logger); - } - - if (this is ISupervisor) - { - return LifeCycle.Environment.Stage.ActorFor( - definition, - this, - LifeCycle.LookUpProxy(), - Logger); - } - - return LifeCycle.Environment.Stage.ActorFor(definition, this, null, Logger); - } - - protected internal T ChildActorFor(Expression> factory) - => ChildActorFor(Definition.Has(factory)); - - /// - /// Answers the protocol for the child Actor to be created by this parent Actor. - /// - /// The type of the child Actor to be created. - /// The Definition of the child Actor to be created by this parent Actor - /// A child Actor of type created by this parent Actor. - protected internal virtual object? ChildActorFor(Type protocol, Definition definition) - { - var method = GetType().GetMethod( - "ChildActorFor", - BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, - null, - new[] { typeof(Definition) }, - null); - - if (method == null) - { - throw new InvalidOperationException("Cannot find 'ChildActorFor' method on Actor"); - } - - return method.MakeGenericMethod(protocol).Invoke(definition, new object[] {definition}); - } - - /// - /// Answers the Protocols for the child Actor to be created by this parent Actor. - /// - /// The protocols for the child Actor. - /// The Definition of the child Actor to be created by this parent Actor. - /// Protocols - protected internal Protocols ChildActorFor(Type[] protocols, Definition definition) - { - if (definition.Supervisor != null) - { - return LifeCycle.Environment.Stage.ActorFor(protocols, definition, this, definition.Supervisor, Logger); - } - - if (this is ISupervisor) - { - return LifeCycle.Environment.Stage.ActorFor(protocols, definition, this, LifeCycle.LookUpProxy(), Logger); - } - - return LifeCycle.Environment.Stage.ActorFor(protocols, definition, this, null, Logger); - } - - /// - /// Answers the ICompletes instance for this Actor, or null if the behavior of the currently - /// delivered IMessage does not answer a ICompletes - /// - /// ICompletes or null, depending on the current IMessage delivered. - protected internal virtual ICompletes Completes() - { - if (CompletesImpl == null || CompletesImpl.InternalClientCompletes == null) - { - throw new InvalidOperationException("Completes is not available for this protocol behavior; return type must not be void."); - } - - return CompletesImpl.ClientCompletes()!; - } - - /// - /// Answers a ICompletesEventually if the behavior of the currently - /// delivered IMessage does answers a ICompletes. Otherwise the outcome - /// is undefined. - /// - /// A ICompletesEventually instance. - protected internal virtual ICompletesEventually CompletesEventually() - => LifeCycle.Environment.CompletesEventually(CompletesImpl); - - /// - /// Answers the Definition of this Actor. - /// - /// Gets the Definition of this Actor - protected internal virtual Definition Definition => LifeCycle.Definition; - - /// - /// Answers the Logger of this Actor. - /// - /// Gets the ILogger instance of this Actor - protected internal ILogger Logger => LifeCycle.Environment.Logger; - - /// - /// Answers the parent of this Actor as the protocol. - /// - /// The protocol type for the parent Actor. - /// The parent Actor as . - protected internal virtual T ParentAs() - { - if (LifeCycle.Environment.IsSecured) - { - throw new InvalidOperationException("A secured actor cannot provide its parent."); - } - - var parent = LifeCycle.Environment.Parent!; - return LifeCycle.Environment.Stage.ActorProxyFor(parent, parent.LifeCycle.Environment.Mailbox); - } - - /// - /// Secures this Actor. - /// - protected virtual void Secure() => LifeCycle.Secure(); - - /// - /// Answers this Actor as a protocol. This Actor must implement the protocol. - /// - /// The protocol type - /// This Actor as - protected internal T SelfAs() => LifeCycle.Environment.Stage.ActorProxyFor(this, LifeCycle.Environment.Mailbox); - - /// - /// Answers the Stage of this Actor. - /// - /// Gets the Stage of this Actor - protected internal Stage Stage - { - get - { - if (LifeCycle.Environment.IsSecured) - { - throw new InvalidOperationException("A secured actor cannot provide its stage."); - } - - return LifeCycle.Environment.Stage; - } - } - - /// - /// Answers the Stage of the given name. - /// - /// The string name of the Stage to find. - /// The Stage with the given - protected internal virtual Stage StageNamed(string name) => LifeCycle.Environment.Stage.World.StageNamed(name); - - //======================================= - // stowing/dispersing - //======================================= - - /// - /// Starts the process of dispersing any messages stowed for this Actor. - /// - protected internal virtual void DisperseStowedMessages() => LifeCycle.Environment.Mailbox.Resume(Mailbox.Paused); - - /// - /// Starts the process of stowing messages for this Actor, and registers as - /// the protocol that will trigger dispersal. - /// - /// The protocol Type(s) that will trigger dispersal - protected internal virtual void StowMessages(params Type[] stowageOverrides) => - LifeCycle.Environment.Mailbox.SuspendExceptFor(Mailbox.Paused, stowageOverrides); - - //======================================= - // life cycle overrides - //======================================= - - /// - /// The message delivered before the Actor has fully started. Override to implement. - /// - protected internal virtual void BeforeStart() - { - // override - } - - /// - /// The message delivered after the Actor has fully stopped. Override to implement. - /// - protected internal virtual void AfterStop() - { - // override - } - - /// - /// The message delivered before the Actor has been restarted by its supervisor due to an exception. - /// Override to implement. - /// - /// The Exception cause of the supervision restart. - protected internal virtual void BeforeRestart(Exception reason) - { - // override for specific recovery - Logger.Error($"Default before restart recovery after: {reason.Message}", reason); - LifeCycle.AfterStop(this); - } - - /// - /// The message delivered after the Actor has been restarted by its supervisor due to an exception. - /// Override to implement. - /// - /// The Exception cause of the supervision restart. - protected internal virtual void AfterRestart(Exception reason) - { - // override for specific recovery - Logger.Error($"Default after restart recovery after: {reason.Message}", reason); - LifeCycle.BeforeStart(this); - } - - /// - /// The message delivered before the Actor has been resumed by its supervisor due to an exception. - /// Override to implement. - /// - /// The Exception cause of the supervision resume. - protected internal virtual void BeforeResume(Exception reason) - { - // override for specific recovery - Logger.Error($"Default before resume recovery after: {reason.Message}", reason); - } - } +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +using System; +using System.Linq.Expressions; +using System.Reflection; +using Vlingo.Actors.TestKit; +using Vlingo.Xoom.Common; + +namespace Vlingo.Actors +{ + /// + /// The abstract base class of all concrete Actor types. This base provides common + /// facilities and life cycle processing for all Actor types. + /// + public abstract class Actor : IStartable, IStoppable, IRelocatable, ITestStateView + { + internal readonly ResultCompletes CompletesImpl; + internal LifeCycle LifeCycle { get; } + + /// + /// Answers the address of this Actor. + /// + /// Gets the Address of this Actor. + public IAddress Address => LifeCycle.Address; + + /// + /// Answers the DeadLetters for this Actor. + /// + /// Gets the DeadLetters for this Actor. + public virtual IDeadLetters? DeadLetters => LifeCycle.Environment.Stage.World.DeadLetters; + + /// + /// Answers the Scheduler for this Actor. + /// + /// Gets the Scheduler for this Actor. + public virtual Scheduler Scheduler => LifeCycle.Environment.Stage.Scheduler; + + /// + public void StateSnapshot(TS stateSnapshot) + { + // no-op + } + + /// + public TS StateSnapshot() => default!; // no-op + + /// + /// The default implementation of Start(), which is a no-op. Override if needed. + /// + public virtual void Start() + { + } + + /// + /// Answers whether or not this Actor has been stopped or is in the process or stopping. + /// + /// true if this Actor is stopped. false otherwise. + public virtual bool IsStopped => LifeCycle.IsStopped; + + public virtual void Conclude() + => SelfAs().Stop(); + + /// + /// Initiates the process of stopping this Actor and all of its children. + /// + public virtual void Stop() + { + if (!IsStopped) + { + if (LifeCycle.Address.Id != World.DeadLettersId) + { + // TODO: remove this actor as a child on parent + LifeCycle.SuspendForStop(); + LifeCycle.Stop(this); + } + } + } + + /// + /// Received from the surrounding to indicate + /// that it is in use, enabling any special test initialization as + /// ended. This is received (1) with a TestContext when the + /// TestActor is first constructed, and (2) with null + /// before each TestMailbox delivery. + /// + /// The TestContext. + public virtual void ViewTestStateInitialization(TestContext? context) { } + + /// + /// Answers the TestState for this Actor. Override to provide a snapshot of the current Actor state. + /// + /// The TestState of this Actor. + public virtual TestState ViewTestState() => new TestState(); + + /// + /// Answers whether or not this Actor is equal to other. + /// + /// The object to which this Actor is compared + /// true if the two objects are of same type and has the same address. false otherwise. + public override bool Equals(object? other) + { + if (other == null || other.GetType() != GetType()) + { + return false; + } + + return Address.Equals(((Actor)other).LifeCycle.Address); + } + + /// + /// Answers the int hash code of this Actor. + /// + /// The hash code of this Actor. + public override int GetHashCode() => LifeCycle.GetHashCode(); + + /// + /// Answers the string representation of this Actor. + /// + /// The string representation of this Actor + public override string ToString() => $"Actor[type={GetType().Name} address={Address}]"; + + /// + /// Answers the parent Actor of this Actor. (INTERNAL ONLY) + /// + /// Gets the parent Actor. + internal virtual Actor Parent + { + get + { + if (LifeCycle.Environment.IsSecured) + { + throw new InvalidOperationException("A secured actor cannot provide its parent."); + } + + return LifeCycle.Environment.Parent!; + } + } + + /// + /// Initializes the newly created Actor. + /// + protected Actor() + { + var maybeEnvironment = ActorFactory.ThreadLocalEnvironment.Value; + LifeCycle = new LifeCycle(maybeEnvironment ?? new TestEnvironment(), new Evictable(this)); + ActorFactory.ThreadLocalEnvironment.Value = null; + CompletesImpl = new ResultCompletes(); + } + + /// + /// Answer my internal from Completes() after preparing + /// for the to be set in my CompletesEventually(). + /// + /// The the provides an eventual outcome + /// The return type of + /// of type + protected internal ICompletes AnswerFrom(ICompletes eventualOutcome) + { + eventualOutcome.AndThenConsume(value => CompletesEventually().With(value)); + return (ICompletes)Completes(); + } + + /// + /// Answers the protocol for the child Actor to be created by this parent Actor. + /// + /// The protocol type + /// The Definition of the child Actor to be created by this parent Actor + /// A child Actor of type created by this parent Actor. + protected internal virtual T ChildActorFor(Definition definition) + { + if (definition.Supervisor != null) + { + return LifeCycle.Environment.Stage.ActorFor( + definition, + this, + definition.Supervisor, + Logger); + } + + if (this is ISupervisor) + { + return LifeCycle.Environment.Stage.ActorFor( + definition, + this, + LifeCycle.LookUpProxy(), + Logger); + } + + return LifeCycle.Environment.Stage.ActorFor(definition, this, null, Logger); + } + + protected internal T ChildActorFor(Expression> factory) + => ChildActorFor(Definition.Has(factory)); + + /// + /// Answers the protocol for the child Actor to be created by this parent Actor. + /// + /// The type of the child Actor to be created. + /// The Definition of the child Actor to be created by this parent Actor + /// A child Actor of type created by this parent Actor. + protected internal virtual object? ChildActorFor(Type protocol, Definition definition) + { + var method = GetType().GetMethod( + "ChildActorFor", + BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, + null, + new[] { typeof(Definition) }, + null); + + if (method == null) + { + throw new InvalidOperationException("Cannot find 'ChildActorFor' method on Actor"); + } + + return method.MakeGenericMethod(protocol).Invoke(definition, new object[] {definition}); + } + + /// + /// Answers the Protocols for the child Actor to be created by this parent Actor. + /// + /// The protocols for the child Actor. + /// The Definition of the child Actor to be created by this parent Actor. + /// Protocols + protected internal Protocols ChildActorFor(Type[] protocols, Definition definition) + { + if (definition.Supervisor != null) + { + return LifeCycle.Environment.Stage.ActorFor(protocols, definition, this, definition.Supervisor, Logger); + } + + if (this is ISupervisor) + { + return LifeCycle.Environment.Stage.ActorFor(protocols, definition, this, LifeCycle.LookUpProxy(), Logger); + } + + return LifeCycle.Environment.Stage.ActorFor(protocols, definition, this, null, Logger); + } + + /// + /// Answers the ICompletes instance for this Actor, or null if the behavior of the currently + /// delivered IMessage does not answer a ICompletes + /// + /// ICompletes or null, depending on the current IMessage delivered. + protected internal virtual ICompletes Completes() + { + if (CompletesImpl == null || CompletesImpl.InternalClientCompletes == null) + { + throw new InvalidOperationException("Completes is not available for this protocol behavior; return type must not be void."); + } + + return CompletesImpl.ClientCompletes()!; + } + + /// + /// Answers a ICompletesEventually if the behavior of the currently + /// delivered IMessage does answers a ICompletes. Otherwise the outcome + /// is undefined. + /// + /// A ICompletesEventually instance. + protected internal virtual ICompletesEventually CompletesEventually() + => LifeCycle.Environment.CompletesEventually(CompletesImpl); + + /// + /// Answers the Definition of this Actor. + /// + /// Gets the Definition of this Actor + protected internal virtual Definition Definition => LifeCycle.Definition; + + /// + /// Answers the Logger of this Actor. + /// + /// Gets the ILogger instance of this Actor + protected internal ILogger Logger => LifeCycle.Environment.Logger; + + /// + /// Answers the parent of this Actor as the protocol. + /// + /// The protocol type for the parent Actor. + /// The parent Actor as . + protected internal virtual T ParentAs() + { + if (LifeCycle.Environment.IsSecured) + { + throw new InvalidOperationException("A secured actor cannot provide its parent."); + } + + var parent = LifeCycle.Environment.Parent!; + return LifeCycle.Environment.Stage.ActorProxyFor(parent, parent.LifeCycle.Environment.Mailbox); + } + + /// + /// Secures this Actor. + /// + protected virtual void Secure() => LifeCycle.Secure(); + + /// + /// Answers this Actor as a protocol. This Actor must implement the protocol. + /// + /// The protocol type + /// This Actor as + protected internal T SelfAs() => LifeCycle.Environment.Stage.ActorProxyFor(this, LifeCycle.Environment.Mailbox); + + /// + /// Answers the Stage of this Actor. + /// + /// Gets the Stage of this Actor + protected internal Stage Stage + { + get + { + if (LifeCycle.Environment.IsSecured) + { + throw new InvalidOperationException("A secured actor cannot provide its stage."); + } + + return LifeCycle.Environment.Stage; + } + } + + /// + /// Answers the Stage of the given name. + /// + /// The string name of the Stage to find. + /// The Stage with the given + protected internal virtual Stage StageNamed(string name) => LifeCycle.Environment.Stage.World.StageNamed(name); + + //======================================= + // stowing/dispersing + //======================================= + + /// + /// Starts the process of dispersing any messages stowed for this Actor. + /// + protected internal virtual void DisperseStowedMessages() => LifeCycle.Environment.Mailbox.Resume(Mailbox.Paused); + + /// + /// Starts the process of stowing messages for this Actor, and registers as + /// the protocol that will trigger dispersal. + /// + /// The protocol Type(s) that will trigger dispersal + protected internal virtual void StowMessages(params Type[] stowageOverrides) => + LifeCycle.Environment.Mailbox.SuspendExceptFor(Mailbox.Paused, stowageOverrides); + + //======================================= + // life cycle overrides + //======================================= + + /// + /// The message delivered before the Actor has fully started. Override to implement. + /// + protected internal virtual void BeforeStart() + { + // override + } + + /// + /// The message delivered after the Actor has fully stopped. Override to implement. + /// + protected internal virtual void AfterStop() + { + // override + } + + /// + /// The message delivered before the Actor has been restarted by its supervisor due to an exception. + /// Override to implement. + /// + /// The Exception cause of the supervision restart. + protected internal virtual void BeforeRestart(Exception reason) + { + // override for specific recovery + Logger.Error($"Default before restart recovery after: {reason.Message}", reason); + LifeCycle.AfterStop(this); + } + + /// + /// The message delivered after the Actor has been restarted by its supervisor due to an exception. + /// Override to implement. + /// + /// The Exception cause of the supervision restart. + protected internal virtual void AfterRestart(Exception reason) + { + // override for specific recovery + Logger.Error($"Default after restart recovery after: {reason.Message}", reason); + LifeCycle.BeforeStart(this); + } + + /// + /// The message delivered before the Actor has been resumed by its supervisor due to an exception. + /// Override to implement. + /// + /// The Exception cause of the supervision resume. + protected internal virtual void BeforeResume(Exception reason) + { + // override for specific recovery + Logger.Error($"Default before resume recovery after: {reason.Message}", reason); + } + } } \ No newline at end of file diff --git a/src/Vlingo.Actors/ActorAddressAlreadyRegisteredException.cs b/src/Vlingo.Xoom.Actors/ActorAddressAlreadyRegisteredException.cs similarity index 100% rename from src/Vlingo.Actors/ActorAddressAlreadyRegisteredException.cs rename to src/Vlingo.Xoom.Actors/ActorAddressAlreadyRegisteredException.cs diff --git a/src/Vlingo.Actors/ActorFactory.cs b/src/Vlingo.Xoom.Actors/ActorFactory.cs similarity index 96% rename from src/Vlingo.Actors/ActorFactory.cs rename to src/Vlingo.Xoom.Actors/ActorFactory.cs index 1b48ad7d..74fffd2a 100644 --- a/src/Vlingo.Actors/ActorFactory.cs +++ b/src/Vlingo.Xoom.Actors/ActorFactory.cs @@ -1,236 +1,236 @@ -// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -using System; -using System.Linq; -using System.Reflection; -using System.Threading; - -namespace Vlingo.Actors -{ - public static class ActorFactory - { - internal static readonly ThreadLocal ThreadLocalEnvironment = new ThreadLocal(false); - - public static Type? ActorClassWithProtocol(string actorClassname) where TProtocol : Actor - => ActorClassWithProtocol(actorClassname, typeof(TProtocol)); - - private static Type? ActorClassWithProtocol(string actorClassname, Type protocolClass) - { - try - { - var actorClass = Type.GetType(actorClassname); - AssertActorWithProtocol(actorClass, protocolClass); - return actorClass; - } - catch (Exception e) - { - throw new ArgumentException($"The class {actorClassname} cannot be loaded because: {e.Message}", e); - } - } - - private static void AssertActorWithProtocol(Type? candidateActorClass, Type protocolClass) - { - var superclass = candidateActorClass?.BaseType; - while (superclass != null) - { - if (superclass == typeof(Actor)) - { - break; - } - superclass = superclass.BaseType; - } - - if (superclass == null) - { - throw new ArgumentException($"Class must extend Vlingo.Actors.Actor: {candidateActorClass?.FullName}"); - } - - var protocolInterfaceClasses = candidateActorClass?.GetInterfaces() ?? new Type[0]; - foreach (var protocolInterfaceClass in protocolInterfaceClasses) - { - if (protocolClass == protocolInterfaceClass) - { - return; - } - } - - throw new ArgumentException($"Actor class {candidateActorClass?.FullName} must implement: {protocolClass.FullName}"); - } - - internal static Actor ActorFor( - Stage stage, - Actor? parent, - Definition definition, - IAddress address, - IMailbox mailbox, - ISupervisor? supervisor, - ILogger logger) - { - var environment = new Environment( - stage, - address, - definition, - parent, - mailbox, - supervisor, - ActorLoggerAdapter.From(logger, address, definition.Type!)); - - ThreadLocalEnvironment.Value = environment; - - Actor? actor = null; - - var definitionParameterCount = definition.InternalParameters().Count(); - - if (definitionParameterCount == 0) - { - if (definition.Type != null) - { - actor = (Actor) Activator.CreateInstance(definition.Type)!; - actor.LifeCycle.SendStart(actor); - } - } - else - { - foreach (var ctor in definition.Type!.GetConstructors()) - { - var expectedConstructorParameters = definition.InternalParameters().ToList(); - var actualParametersInfosOfConstructor = ctor.GetParameters(); - if (actualParametersInfosOfConstructor.Length != definitionParameterCount) - { - continue; - } - - var differentParameterType = false; - for (var i = 0; i < actualParametersInfosOfConstructor.Length; i++) - { - if (actualParametersInfosOfConstructor[i].ParameterType != expectedConstructorParameters[i].GetType() - && !actualParametersInfosOfConstructor[i].ParameterType.IsAssignableFrom(expectedConstructorParameters[i].GetType())) - { - differentParameterType = true; - break; - } - } - - if (differentParameterType) - continue; - - actor = Start(ctor, address, definition, logger); - - if(actor != null) - { - break; - } - } - } - - if (actor == null) - { - throw new MissingMethodException("No constructor matches the given number of parameters."); - } - - if (parent != null) - { - parent.LifeCycle.Environment.AddChild(actor); - } - - return actor; - } - - private static Actor? Start(ConstructorInfo ctor, IAddress address, Definition definition, ILogger logger) - { - Actor? actor; - object[]? args = null; - Exception? cause = null; - - for (var times = 1; times <= 2; ++times) - { - try - { - if (times == 1) - { - args = definition.InternalParameters().ToArray(); - } - - actor = (Actor)ctor.Invoke(definition.InternalParameters().ToArray()); - actor.LifeCycle.SendStart(actor); - return actor; - } - catch (Exception ex) - { - cause = ex.InnerException ?? ex; - if(times == 1) - { - args = Unfold(args!); - } - } - } - - if (cause != null) - { - logger.Error("ActorFactory: failed actor creation. " - + "This is sometimes cause by the constructor parameter types not matching " - + "the types in the Definition.parameters(). Often it is caused by a " - + "failure in the actor constructor. We have attempted to uncover " - + "the root cause here, but that may not be available in some cases.\n" - + "The root cause may be: " + cause.Message + "\n" - + "See stacktrace for more information. We strongly recommend reviewing your " - + "constructor for possible failures in dependencies that it creates.", - cause); - - throw new ArgumentException($"ActorFactory failed actor creation for: {address}"); - } - - return null; - } - - private static object[] Unfold(object[] args) - { - var unfolded = new object[args.Length]; - for (var i = 0; i < args.Length; ++i) - { - var currentArg = args[i]; - if (currentArg.GetType().IsArray) - { - unfolded[i] = ((object[])currentArg)[0]; - } - else - { - unfolded[i] = args[i]; - } - } - - return unfolded; - } - - internal static IMailbox ActorMailbox( - Stage stage, - IAddress? address, - Definition definition, - IMailboxWrapper wrapper) - { - var mailboxName = stage.World.MailboxNameFrom(definition.MailboxName); - var mailbox = stage.World.AssignMailbox(mailboxName, address?.GetHashCode()); - - return wrapper.Wrap(address, mailbox); - } - - internal static IMailbox ActorMailbox(Stage stage, - IAddress address, - Definition definition) => ActorMailbox(stage, address, definition, new IdentityMailboxWrapper()); - - public interface IMailboxWrapper - { - IMailbox Wrap(IAddress? address, IMailbox mailbox); - } - - internal class IdentityMailboxWrapper : IMailboxWrapper - { - public IMailbox Wrap(IAddress? address, IMailbox mailbox) => mailbox; - } - } +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +using System; +using System.Linq; +using System.Reflection; +using System.Threading; + +namespace Vlingo.Actors +{ + public static class ActorFactory + { + internal static readonly ThreadLocal ThreadLocalEnvironment = new ThreadLocal(false); + + public static Type? ActorClassWithProtocol(string actorClassname) where TProtocol : Actor + => ActorClassWithProtocol(actorClassname, typeof(TProtocol)); + + private static Type? ActorClassWithProtocol(string actorClassname, Type protocolClass) + { + try + { + var actorClass = Type.GetType(actorClassname); + AssertActorWithProtocol(actorClass, protocolClass); + return actorClass; + } + catch (Exception e) + { + throw new ArgumentException($"The class {actorClassname} cannot be loaded because: {e.Message}", e); + } + } + + private static void AssertActorWithProtocol(Type? candidateActorClass, Type protocolClass) + { + var superclass = candidateActorClass?.BaseType; + while (superclass != null) + { + if (superclass == typeof(Actor)) + { + break; + } + superclass = superclass.BaseType; + } + + if (superclass == null) + { + throw new ArgumentException($"Class must extend Vlingo.Xoom.Actors.Actor: {candidateActorClass?.FullName}"); + } + + var protocolInterfaceClasses = candidateActorClass?.GetInterfaces() ?? new Type[0]; + foreach (var protocolInterfaceClass in protocolInterfaceClasses) + { + if (protocolClass == protocolInterfaceClass) + { + return; + } + } + + throw new ArgumentException($"Actor class {candidateActorClass?.FullName} must implement: {protocolClass.FullName}"); + } + + internal static Actor ActorFor( + Stage stage, + Actor? parent, + Definition definition, + IAddress address, + IMailbox mailbox, + ISupervisor? supervisor, + ILogger logger) + { + var environment = new Environment( + stage, + address, + definition, + parent, + mailbox, + supervisor, + ActorLoggerAdapter.From(logger, address, definition.Type!)); + + ThreadLocalEnvironment.Value = environment; + + Actor? actor = null; + + var definitionParameterCount = definition.InternalParameters().Count(); + + if (definitionParameterCount == 0) + { + if (definition.Type != null) + { + actor = (Actor) Activator.CreateInstance(definition.Type)!; + actor.LifeCycle.SendStart(actor); + } + } + else + { + foreach (var ctor in definition.Type!.GetConstructors()) + { + var expectedConstructorParameters = definition.InternalParameters().ToList(); + var actualParametersInfosOfConstructor = ctor.GetParameters(); + if (actualParametersInfosOfConstructor.Length != definitionParameterCount) + { + continue; + } + + var differentParameterType = false; + for (var i = 0; i < actualParametersInfosOfConstructor.Length; i++) + { + if (actualParametersInfosOfConstructor[i].ParameterType != expectedConstructorParameters[i].GetType() + && !actualParametersInfosOfConstructor[i].ParameterType.IsAssignableFrom(expectedConstructorParameters[i].GetType())) + { + differentParameterType = true; + break; + } + } + + if (differentParameterType) + continue; + + actor = Start(ctor, address, definition, logger); + + if(actor != null) + { + break; + } + } + } + + if (actor == null) + { + throw new MissingMethodException("No constructor matches the given number of parameters."); + } + + if (parent != null) + { + parent.LifeCycle.Environment.AddChild(actor); + } + + return actor; + } + + private static Actor? Start(ConstructorInfo ctor, IAddress address, Definition definition, ILogger logger) + { + Actor? actor; + object[]? args = null; + Exception? cause = null; + + for (var times = 1; times <= 2; ++times) + { + try + { + if (times == 1) + { + args = definition.InternalParameters().ToArray(); + } + + actor = (Actor)ctor.Invoke(definition.InternalParameters().ToArray()); + actor.LifeCycle.SendStart(actor); + return actor; + } + catch (Exception ex) + { + cause = ex.InnerException ?? ex; + if(times == 1) + { + args = Unfold(args!); + } + } + } + + if (cause != null) + { + logger.Error("ActorFactory: failed actor creation. " + + "This is sometimes cause by the constructor parameter types not matching " + + "the types in the Definition.parameters(). Often it is caused by a " + + "failure in the actor constructor. We have attempted to uncover " + + "the root cause here, but that may not be available in some cases.\n" + + "The root cause may be: " + cause.Message + "\n" + + "See stacktrace for more information. We strongly recommend reviewing your " + + "constructor for possible failures in dependencies that it creates.", + cause); + + throw new ArgumentException($"ActorFactory failed actor creation for: {address}"); + } + + return null; + } + + private static object[] Unfold(object[] args) + { + var unfolded = new object[args.Length]; + for (var i = 0; i < args.Length; ++i) + { + var currentArg = args[i]; + if (currentArg.GetType().IsArray) + { + unfolded[i] = ((object[])currentArg)[0]; + } + else + { + unfolded[i] = args[i]; + } + } + + return unfolded; + } + + internal static IMailbox ActorMailbox( + Stage stage, + IAddress? address, + Definition definition, + IMailboxWrapper wrapper) + { + var mailboxName = stage.World.MailboxNameFrom(definition.MailboxName); + var mailbox = stage.World.AssignMailbox(mailboxName, address?.GetHashCode()); + + return wrapper.Wrap(address, mailbox); + } + + internal static IMailbox ActorMailbox(Stage stage, + IAddress address, + Definition definition) => ActorMailbox(stage, address, definition, new IdentityMailboxWrapper()); + + public interface IMailboxWrapper + { + IMailbox Wrap(IAddress? address, IMailbox mailbox); + } + + internal class IdentityMailboxWrapper : IMailboxWrapper + { + public IMailbox Wrap(IAddress? address, IMailbox mailbox) => mailbox; + } + } } \ No newline at end of file diff --git a/src/Vlingo.Actors/ActorLoggerAdapter.cs b/src/Vlingo.Xoom.Actors/ActorLoggerAdapter.cs similarity index 100% rename from src/Vlingo.Actors/ActorLoggerAdapter.cs rename to src/Vlingo.Xoom.Actors/ActorLoggerAdapter.cs diff --git a/src/Vlingo.Actors/ActorProxy.cs b/src/Vlingo.Xoom.Actors/ActorProxy.cs similarity index 100% rename from src/Vlingo.Actors/ActorProxy.cs rename to src/Vlingo.Xoom.Actors/ActorProxy.cs diff --git a/src/Vlingo.Actors/ActorProxyBase.cs b/src/Vlingo.Xoom.Actors/ActorProxyBase.cs similarity index 100% rename from src/Vlingo.Actors/ActorProxyBase.cs rename to src/Vlingo.Xoom.Actors/ActorProxyBase.cs diff --git a/src/Vlingo.Actors/ActorProxyStub.cs b/src/Vlingo.Xoom.Actors/ActorProxyStub.cs similarity index 100% rename from src/Vlingo.Actors/ActorProxyStub.cs rename to src/Vlingo.Xoom.Actors/ActorProxyStub.cs diff --git a/src/Vlingo.Actors/Addressable__Proxy.cs b/src/Vlingo.Xoom.Actors/Addressable__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/Addressable__Proxy.cs rename to src/Vlingo.Xoom.Actors/Addressable__Proxy.cs diff --git a/src/Vlingo.Actors/Backoff.cs b/src/Vlingo.Xoom.Actors/Backoff.cs similarity index 100% rename from src/Vlingo.Actors/Backoff.cs rename to src/Vlingo.Xoom.Actors/Backoff.cs diff --git a/src/Vlingo.Actors/BasicAddress.cs b/src/Vlingo.Xoom.Actors/BasicAddress.cs similarity index 100% rename from src/Vlingo.Actors/BasicAddress.cs rename to src/Vlingo.Xoom.Actors/BasicAddress.cs diff --git a/src/Vlingo.Actors/BasicAddressFactory.cs b/src/Vlingo.Xoom.Actors/BasicAddressFactory.cs similarity index 100% rename from src/Vlingo.Actors/BasicAddressFactory.cs rename to src/Vlingo.Xoom.Actors/BasicAddressFactory.cs diff --git a/src/Vlingo.Actors/BroadcastRouter.cs b/src/Vlingo.Xoom.Actors/BroadcastRouter.cs similarity index 100% rename from src/Vlingo.Actors/BroadcastRouter.cs rename to src/Vlingo.Xoom.Actors/BroadcastRouter.cs diff --git a/src/Vlingo.Actors/Cancellable__Proxy.cs b/src/Vlingo.Xoom.Actors/Cancellable__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/Cancellable__Proxy.cs rename to src/Vlingo.Xoom.Actors/Cancellable__Proxy.cs diff --git a/src/Vlingo.Actors/Characters.cs b/src/Vlingo.Xoom.Actors/Characters.cs similarity index 100% rename from src/Vlingo.Actors/Characters.cs rename to src/Vlingo.Xoom.Actors/Characters.cs diff --git a/src/Vlingo.Actors/CommonSupervisor.cs b/src/Vlingo.Xoom.Actors/CommonSupervisor.cs similarity index 100% rename from src/Vlingo.Actors/CommonSupervisor.cs rename to src/Vlingo.Xoom.Actors/CommonSupervisor.cs diff --git a/src/Vlingo.Actors/CompletesEventuallyActor.cs b/src/Vlingo.Xoom.Actors/CompletesEventuallyActor.cs similarity index 100% rename from src/Vlingo.Actors/CompletesEventuallyActor.cs rename to src/Vlingo.Xoom.Actors/CompletesEventuallyActor.cs diff --git a/src/Vlingo.Actors/CompletesEventually__Proxy.cs b/src/Vlingo.Xoom.Actors/CompletesEventually__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/CompletesEventually__Proxy.cs rename to src/Vlingo.Xoom.Actors/CompletesEventually__Proxy.cs diff --git a/src/Vlingo.Actors/CompletionSupplier.cs b/src/Vlingo.Xoom.Actors/CompletionSupplier.cs similarity index 100% rename from src/Vlingo.Actors/CompletionSupplier.cs rename to src/Vlingo.Xoom.Actors/CompletionSupplier.cs diff --git a/src/Vlingo.Actors/CompletionTranslator.cs b/src/Vlingo.Xoom.Actors/CompletionTranslator.cs similarity index 100% rename from src/Vlingo.Actors/CompletionTranslator.cs rename to src/Vlingo.Xoom.Actors/CompletionTranslator.cs diff --git a/src/Vlingo.Actors/Configuration.cs b/src/Vlingo.Xoom.Actors/Configuration.cs similarity index 100% rename from src/Vlingo.Actors/Configuration.cs rename to src/Vlingo.Xoom.Actors/Configuration.cs diff --git a/src/Vlingo.Actors/ContentBasedRouter.cs b/src/Vlingo.Xoom.Actors/ContentBasedRouter.cs similarity index 100% rename from src/Vlingo.Actors/ContentBasedRouter.cs rename to src/Vlingo.Xoom.Actors/ContentBasedRouter.cs diff --git a/src/Vlingo.Actors/DeadLetter.cs b/src/Vlingo.Xoom.Actors/DeadLetter.cs similarity index 100% rename from src/Vlingo.Actors/DeadLetter.cs rename to src/Vlingo.Xoom.Actors/DeadLetter.cs diff --git a/src/Vlingo.Actors/DeadLettersActor.cs b/src/Vlingo.Xoom.Actors/DeadLettersActor.cs similarity index 100% rename from src/Vlingo.Actors/DeadLettersActor.cs rename to src/Vlingo.Xoom.Actors/DeadLettersActor.cs diff --git a/src/Vlingo.Actors/DeadLettersListener__Proxy.cs b/src/Vlingo.Xoom.Actors/DeadLettersListener__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/DeadLettersListener__Proxy.cs rename to src/Vlingo.Xoom.Actors/DeadLettersListener__Proxy.cs diff --git a/src/Vlingo.Actors/DeadLetters__Proxy.cs b/src/Vlingo.Xoom.Actors/DeadLetters__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/DeadLetters__Proxy.cs rename to src/Vlingo.Xoom.Actors/DeadLetters__Proxy.cs diff --git a/src/Vlingo.Actors/DefaultSupervisionStrategyImpl.cs b/src/Vlingo.Xoom.Actors/DefaultSupervisionStrategyImpl.cs similarity index 100% rename from src/Vlingo.Actors/DefaultSupervisionStrategyImpl.cs rename to src/Vlingo.Xoom.Actors/DefaultSupervisionStrategyImpl.cs diff --git a/src/Vlingo.Actors/DefaultSupervisor.cs b/src/Vlingo.Xoom.Actors/DefaultSupervisor.cs similarity index 100% rename from src/Vlingo.Actors/DefaultSupervisor.cs rename to src/Vlingo.Xoom.Actors/DefaultSupervisor.cs diff --git a/src/Vlingo.Actors/DefaultSupervisorImpl.cs b/src/Vlingo.Xoom.Actors/DefaultSupervisorImpl.cs similarity index 100% rename from src/Vlingo.Actors/DefaultSupervisorImpl.cs rename to src/Vlingo.Xoom.Actors/DefaultSupervisorImpl.cs diff --git a/src/Vlingo.Actors/Definition.cs b/src/Vlingo.Xoom.Actors/Definition.cs similarity index 97% rename from src/Vlingo.Actors/Definition.cs rename to src/Vlingo.Xoom.Actors/Definition.cs index f35b5abb..1f8b7ae8 100644 --- a/src/Vlingo.Actors/Definition.cs +++ b/src/Vlingo.Xoom.Actors/Definition.cs @@ -1,462 +1,462 @@ -// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; - -namespace Vlingo.Actors -{ - // TODO: possible removal/cleanup of overloaded ctors - public sealed class Definition - { - private readonly IEnumerable _parameters; - private ILogger? Logger { get; } - - public static readonly List NoParameters = new List(); - - public static Definition From(Stage stage, SerializationProxy? proxy, ILogger logger) - { - Actor? parent = null; - if (proxy?.Parent != null) - { - ActorProxyBase.Thunk(stage, proxy.Parent); - parent = stage.Directory.ActorOf(proxy.Parent?.Address); - } - - return new Definition( - proxy?.Type, - proxy?.Parameters ?? Enumerable.Empty(), - parent, - proxy?.MailboxName, - proxy?.ActorName, - logger, - proxy?.Evictable ?? false - ); - } - - public static Definition Has(IEnumerable parameters) where T : Actor - => new Definition(typeof(T), parameters, false); - - public static Definition Has(IEnumerable parameters, ILogger logger) where T : Actor - => new Definition(typeof(T), parameters, logger); - - public static Definition Has(IEnumerable parameters, string actorName) where T : Actor - => new Definition(typeof(T), parameters, actorName); - - public static Definition Has(Type typeOfT, IEnumerable parameters) - => new Definition(typeOfT, parameters); - - public static Definition Has(Type? typeOfT, IEnumerable parameters, string actorName) - => new Definition(typeOfT, parameters, actorName); - - public static Definition Has(Expression> factory, bool evictable) - => Has(factory, null, null, null, null, evictable); - - public static Definition Has(Expression> factory) - => Has(factory, null, null, null, null, false); - - public static Definition Has(Expression> factory, string? actorName, bool evictable) - => Has(factory, null, null, actorName, null, evictable); - - public static Definition Has(Expression> factory, string? actorName) - => Has(factory, null, null, actorName, null, false); - - public static Definition Has(Expression> factory, string? actorName, ILogger? logger, bool evictable) - => Has(factory, null, null, actorName, logger, evictable); - - public static Definition Has(Expression> factory, string? actorName, ILogger? logger) - => Has(factory, null, null, actorName, logger, false); - - public static Definition Has(Expression> factory, Actor? parent, string? actorName, bool evictable) - => Has(factory, parent, null, actorName, null, evictable); - - public static Definition Has(Expression> factory, Actor? parent, string? actorName) - => Has(factory, parent, null, actorName, null, false); - - public static Definition Has(Expression> factory, string? mailboxName, string? actorName, bool evictable) - => Has(factory, null, mailboxName, actorName, null, evictable); - - public static Definition Has(Expression> factory, string? mailboxName, string? actorName) - => Has(factory, null, mailboxName, actorName, null, false); - - public static Definition Has(Expression> factory, Actor? parent, string? mailboxName, string? actorName, bool evictable) - => Has(factory, parent, mailboxName, actorName, null, evictable); - - public static Definition Has(Expression> factory, Actor? parent, string? mailboxName, string? actorName) - => Has(factory, parent, mailboxName, actorName, null, false); - - public static Definition Has(Expression> factory, Actor? parent, string? mailboxName, string? actorName, ILogger? logger, bool evictable) - { - var newExpression = factory.Body as NewExpression; - if (newExpression == null) - throw new ArgumentException("The create function must be a 'new T (parameters)' expression"); - - var expressionType = newExpression.Type; - if (!typeof(Actor).IsAssignableFrom(expressionType)) - throw new ArgumentException($"The type '{expressionType.FullName}' must be instance of an actor. Derive it from Actor class."); - - var parameters = newExpression.GetArguments(); - - return new Definition(expressionType, parameters, parent, mailboxName, actorName, logger, evictable); - } - - public static Definition Has( - IEnumerable parameters, - string actorName, - ILogger logger, - bool evictable) - where T : Actor - => new Definition(typeof(T), parameters, actorName, logger, evictable); - - public static Definition Has( - IEnumerable parameters, - string actorName, - ILogger logger) - where T : Actor - => new Definition(typeof(T), parameters, actorName, logger, false); - - public static Definition Has( - IEnumerable parameters, - Actor parent, - string actorName, - bool evictable) - where T : Actor - => new Definition(typeof(T), parameters, parent, actorName, evictable); - - public static Definition Has( - IEnumerable parameters, - Actor parent, - string actorName) - where T : Actor - => new Definition(typeof(T), parameters, parent, actorName, false); - - public static Definition Has( - IEnumerable parameters, - string mailboxName, - string actorName, - bool evictable) - where T : Actor - => new Definition(typeof(T), parameters, null, mailboxName, actorName, evictable); - - public static Definition Has( - IEnumerable parameters, - string mailboxName, - string actorName) - where T : Actor - => new Definition(typeof(T), parameters, null, mailboxName, actorName, false); - - public static Definition Has( - Type? typeOfT, - IEnumerable parameters, - string mailboxName, - string? actorName, - bool evictable) - => new Definition(typeOfT, parameters, null, mailboxName, actorName, evictable); - - public static Definition Has( - Type? typeOfT, - IEnumerable parameters, - string mailboxName, - string? actorName) - => new Definition(typeOfT, parameters, null, mailboxName, actorName, false); - - public static Definition Has( - IEnumerable parameters, - Actor parent, - string mailboxName, - string actorName, - bool evictable) - where T : Actor - => new Definition(typeof(T), parameters, parent, mailboxName, actorName, evictable); - - public static Definition Has( - IEnumerable parameters, - Actor parent, - string mailboxName, - string actorName) - where T : Actor - => new Definition(typeof(T), parameters, parent, mailboxName, actorName, false); - - public static Definition Has( - IEnumerable parameters, - Actor parent, - string mailboxName, - string actorName, - ILogger logger, - bool evictable) - where T : Actor - => new Definition(typeof(T), parameters, parent, mailboxName, actorName, logger, evictable); - - public static Definition Has( - IEnumerable parameters, - Actor parent, - string mailboxName, - string actorName, - ILogger logger) - where T : Actor - => new Definition(typeof(T), parameters, parent, mailboxName, actorName, logger, false); - - // TODO: possible cleanup - public static IEnumerable Parameters(params object[] parameters) => parameters; - - public Type? Type { get; } - public Actor? Parent { get; } - public string? MailboxName { get; } - public string? ActorName { get; } - public ISupervisor? Supervisor { get; } - public bool Evictable { get; } - - private Definition( - Type? type, - IEnumerable parameters, - Actor? parent, - string? mailboxName, - string? actorName, - ILogger? logger, - bool evictable) - { - Type = type; - _parameters = parameters; - Parent = parent; - MailboxName = mailboxName; - ActorName = actorName; - Supervisor = AssignSupervisor(parent); - Logger = logger; - Evictable = evictable; - } - - private Definition( - Type? type, - IEnumerable parameters, - Actor? parent, - string mailboxName, - string? actorName, - bool evictable) : - this(type, parameters, parent, mailboxName, actorName, null, evictable) - { - } - - private Definition( - Type? type, - IEnumerable parameters, - Actor? parent, - string mailboxName, - string? actorName) : - this(type, parameters, parent, mailboxName, actorName, null, false) - { - } - - private Definition( - Type type, - IEnumerable parameters, - Actor? parent, - string actorName, - bool evictable) : - this(type, parameters, parent, null, actorName, null, evictable) - { - } - - private Definition( - Type type, - IEnumerable parameters, - Actor? parent, - string actorName) : - this(type, parameters, parent, null, actorName, null, false) - { - } - - private Definition( - Type? type, - IEnumerable parameters, - string actorName, - bool evictable) : - this(type, parameters, null, null, actorName, null, evictable) - { - } - - private Definition( - Type? type, - IEnumerable parameters, - string actorName) : - this(type, parameters, null, null, actorName, null, false) - { - } - - private Definition( - Type type, - IEnumerable parameters, - string actorName, - ILogger logger, - bool evictable) : - this(type, parameters, null, null, actorName, logger, evictable) - { - } - - private Definition( - Type type, - IEnumerable parameters, - string actorName, - ILogger logger) : - this(type, parameters, null, null, actorName, logger, false) - { - } - - private Definition( - Type type, - IEnumerable parameters, - ILogger logger, - bool evictable) : - this(type, parameters, null, null, null, logger, evictable) - { - } - - private Definition( - Type type, - IEnumerable parameters, - ILogger logger) : - this(type, parameters, null, null, null, logger, false) - { - } - - public Definition(Type type, IEnumerable parameters, bool evictable) : - this(type, parameters, null, null, null, null, evictable) - { - } - - private Definition(Type type, IEnumerable parameters) : - this(type, parameters, null, null, null, null, false) - { - } - - public ILogger LoggerOr(ILogger defaultLogger) - { - return Logger ?? defaultLogger; - } - - public IEnumerable Parameters() => new List(InternalParameters()); - - public Actor? ParentOr(Actor? defaultParent) => Parent ?? defaultParent; - - internal IEnumerable InternalParameters() => _parameters; - - private static ISupervisor? AssignSupervisor(Actor? parent) - { - if (parent is ISupervisor) - { - return parent.LifeCycle.Environment.Stage.ActorAs(parent); - } - return null; - } - - public class SerializationProxy - { - public string ActorName { get; } - public string MailboxName { get; } - public IEnumerable Parameters { get; } - public ActorProxyStub Parent { get; } - public Type Type { get; } - public bool Evictable { get; } - - public static SerializationProxy From(Definition definition) => - new SerializationProxy( - definition.ActorName!, - definition.MailboxName!, - definition._parameters!, - definition.Parent != null ? new ActorProxyStub(definition.Parent) : null!, - definition.Type!, - definition.Evictable); - - public SerializationProxy( - string actorName, - string mailboxName, - IEnumerable parameters, - ActorProxyStub parent, - Type type, - bool evictable) - { - ActorName = actorName; - MailboxName = mailboxName; - Parameters = parameters; - Parent = parent; - Type = type; - Evictable = evictable; - } - - public override bool Equals(object? obj) - { - if (this == obj) - { - return true; - } - if (obj == null || GetType() != obj.GetType()) - { - return false; - } - - var that = (SerializationProxy) obj; - - return ActorName == that.ActorName - && MailboxName == that.MailboxName - && Equals(Parameters, that.Parameters) - && Parent == that.Parent - && Type == that.Type; - } - - public override int GetHashCode() => - 31 * ActorName.GetHashCode() + MailboxName.GetHashCode() + GetHashCode(Parameters) + - Parent.GetHashCode() + Type.GetHashCode(); - - public override string ToString() => $"Definition(ActorName='{ActorName}', MailboxName='{MailboxName}', Parameters='{Parameters.Select(p => p.ToString())}', Parent='{Parent}', type='{Type}')"; - - private bool Equals(IEnumerable? p1, IEnumerable? p2) - { - if (p1 == null || p2 == null) - { - return false; - } - - var parameters1 = p1.ToList(); - var parameters2 = p2.ToList(); - - var count1 = parameters1.Count; - var count2 = parameters2.Count; - if (count1 != count2) - { - return false; - } - - for (var i = 0; i < count1; i++) - { - if (!parameters1[i].Equals(parameters2[i])) - { - return false; - } - } - - return true; - } - - private int GetHashCode(IEnumerable parameters) - { - var hashCode = 0; - foreach (var parameter in parameters) - { - if (hashCode == 0) - { - hashCode += 31 * parameter.GetHashCode(); - } - - hashCode += parameter.GetHashCode(); - } - - return hashCode; - } - } - } +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; + +namespace Vlingo.Actors +{ + // TODO: possible removal/cleanup of overloaded ctors + public sealed class Definition + { + private readonly IEnumerable _parameters; + private ILogger? Logger { get; } + + public static readonly List NoParameters = new List(); + + public static Definition From(Stage stage, SerializationProxy? proxy, ILogger logger) + { + Actor? parent = null; + if (proxy?.Parent != null) + { + ActorProxyBase.Thunk(stage, proxy.Parent); + parent = stage.Directory.ActorOf(proxy.Parent?.Address); + } + + return new Definition( + proxy?.Type, + proxy?.Parameters ?? Enumerable.Empty(), + parent, + proxy?.MailboxName, + proxy?.ActorName, + logger, + proxy?.Evictable ?? false + ); + } + + public static Definition Has(IEnumerable parameters) where T : Actor + => new Definition(typeof(T), parameters, false); + + public static Definition Has(IEnumerable parameters, ILogger logger) where T : Actor + => new Definition(typeof(T), parameters, logger); + + public static Definition Has(IEnumerable parameters, string actorName) where T : Actor + => new Definition(typeof(T), parameters, actorName); + + public static Definition Has(Type typeOfT, IEnumerable parameters) + => new Definition(typeOfT, parameters); + + public static Definition Has(Type? typeOfT, IEnumerable parameters, string actorName) + => new Definition(typeOfT, parameters, actorName); + + public static Definition Has(Expression> factory, bool evictable) + => Has(factory, null, null, null, null, evictable); + + public static Definition Has(Expression> factory) + => Has(factory, null, null, null, null, false); + + public static Definition Has(Expression> factory, string? actorName, bool evictable) + => Has(factory, null, null, actorName, null, evictable); + + public static Definition Has(Expression> factory, string? actorName) + => Has(factory, null, null, actorName, null, false); + + public static Definition Has(Expression> factory, string? actorName, ILogger? logger, bool evictable) + => Has(factory, null, null, actorName, logger, evictable); + + public static Definition Has(Expression> factory, string? actorName, ILogger? logger) + => Has(factory, null, null, actorName, logger, false); + + public static Definition Has(Expression> factory, Actor? parent, string? actorName, bool evictable) + => Has(factory, parent, null, actorName, null, evictable); + + public static Definition Has(Expression> factory, Actor? parent, string? actorName) + => Has(factory, parent, null, actorName, null, false); + + public static Definition Has(Expression> factory, string? mailboxName, string? actorName, bool evictable) + => Has(factory, null, mailboxName, actorName, null, evictable); + + public static Definition Has(Expression> factory, string? mailboxName, string? actorName) + => Has(factory, null, mailboxName, actorName, null, false); + + public static Definition Has(Expression> factory, Actor? parent, string? mailboxName, string? actorName, bool evictable) + => Has(factory, parent, mailboxName, actorName, null, evictable); + + public static Definition Has(Expression> factory, Actor? parent, string? mailboxName, string? actorName) + => Has(factory, parent, mailboxName, actorName, null, false); + + public static Definition Has(Expression> factory, Actor? parent, string? mailboxName, string? actorName, ILogger? logger, bool evictable) + { + var newExpression = factory.Body as NewExpression; + if (newExpression == null) + throw new ArgumentException("The create function must be a 'new T (parameters)' expression"); + + var expressionType = newExpression.Type; + if (!typeof(Actor).IsAssignableFrom(expressionType)) + throw new ArgumentException($"The type '{expressionType.FullName}' must be instance of an actor. Derive it from Actor class."); + + var parameters = newExpression.GetArguments(); + + return new Definition(expressionType, parameters, parent, mailboxName, actorName, logger, evictable); + } + + public static Definition Has( + IEnumerable parameters, + string actorName, + ILogger logger, + bool evictable) + where T : Actor + => new Definition(typeof(T), parameters, actorName, logger, evictable); + + public static Definition Has( + IEnumerable parameters, + string actorName, + ILogger logger) + where T : Actor + => new Definition(typeof(T), parameters, actorName, logger, false); + + public static Definition Has( + IEnumerable parameters, + Actor parent, + string actorName, + bool evictable) + where T : Actor + => new Definition(typeof(T), parameters, parent, actorName, evictable); + + public static Definition Has( + IEnumerable parameters, + Actor parent, + string actorName) + where T : Actor + => new Definition(typeof(T), parameters, parent, actorName, false); + + public static Definition Has( + IEnumerable parameters, + string mailboxName, + string actorName, + bool evictable) + where T : Actor + => new Definition(typeof(T), parameters, null, mailboxName, actorName, evictable); + + public static Definition Has( + IEnumerable parameters, + string mailboxName, + string actorName) + where T : Actor + => new Definition(typeof(T), parameters, null, mailboxName, actorName, false); + + public static Definition Has( + Type? typeOfT, + IEnumerable parameters, + string mailboxName, + string? actorName, + bool evictable) + => new Definition(typeOfT, parameters, null, mailboxName, actorName, evictable); + + public static Definition Has( + Type? typeOfT, + IEnumerable parameters, + string mailboxName, + string? actorName) + => new Definition(typeOfT, parameters, null, mailboxName, actorName, false); + + public static Definition Has( + IEnumerable parameters, + Actor parent, + string mailboxName, + string actorName, + bool evictable) + where T : Actor + => new Definition(typeof(T), parameters, parent, mailboxName, actorName, evictable); + + public static Definition Has( + IEnumerable parameters, + Actor parent, + string mailboxName, + string actorName) + where T : Actor + => new Definition(typeof(T), parameters, parent, mailboxName, actorName, false); + + public static Definition Has( + IEnumerable parameters, + Actor parent, + string mailboxName, + string actorName, + ILogger logger, + bool evictable) + where T : Actor + => new Definition(typeof(T), parameters, parent, mailboxName, actorName, logger, evictable); + + public static Definition Has( + IEnumerable parameters, + Actor parent, + string mailboxName, + string actorName, + ILogger logger) + where T : Actor + => new Definition(typeof(T), parameters, parent, mailboxName, actorName, logger, false); + + // TODO: possible cleanup + public static IEnumerable Parameters(params object[] parameters) => parameters; + + public Type? Type { get; } + public Actor? Parent { get; } + public string? MailboxName { get; } + public string? ActorName { get; } + public ISupervisor? Supervisor { get; } + public bool Evictable { get; } + + private Definition( + Type? type, + IEnumerable parameters, + Actor? parent, + string? mailboxName, + string? actorName, + ILogger? logger, + bool evictable) + { + Type = type; + _parameters = parameters; + Parent = parent; + MailboxName = mailboxName; + ActorName = actorName; + Supervisor = AssignSupervisor(parent); + Logger = logger; + Evictable = evictable; + } + + private Definition( + Type? type, + IEnumerable parameters, + Actor? parent, + string mailboxName, + string? actorName, + bool evictable) : + this(type, parameters, parent, mailboxName, actorName, null, evictable) + { + } + + private Definition( + Type? type, + IEnumerable parameters, + Actor? parent, + string mailboxName, + string? actorName) : + this(type, parameters, parent, mailboxName, actorName, null, false) + { + } + + private Definition( + Type type, + IEnumerable parameters, + Actor? parent, + string actorName, + bool evictable) : + this(type, parameters, parent, null, actorName, null, evictable) + { + } + + private Definition( + Type type, + IEnumerable parameters, + Actor? parent, + string actorName) : + this(type, parameters, parent, null, actorName, null, false) + { + } + + private Definition( + Type? type, + IEnumerable parameters, + string actorName, + bool evictable) : + this(type, parameters, null, null, actorName, null, evictable) + { + } + + private Definition( + Type? type, + IEnumerable parameters, + string actorName) : + this(type, parameters, null, null, actorName, null, false) + { + } + + private Definition( + Type type, + IEnumerable parameters, + string actorName, + ILogger logger, + bool evictable) : + this(type, parameters, null, null, actorName, logger, evictable) + { + } + + private Definition( + Type type, + IEnumerable parameters, + string actorName, + ILogger logger) : + this(type, parameters, null, null, actorName, logger, false) + { + } + + private Definition( + Type type, + IEnumerable parameters, + ILogger logger, + bool evictable) : + this(type, parameters, null, null, null, logger, evictable) + { + } + + private Definition( + Type type, + IEnumerable parameters, + ILogger logger) : + this(type, parameters, null, null, null, logger, false) + { + } + + public Definition(Type type, IEnumerable parameters, bool evictable) : + this(type, parameters, null, null, null, null, evictable) + { + } + + private Definition(Type type, IEnumerable parameters) : + this(type, parameters, null, null, null, null, false) + { + } + + public ILogger LoggerOr(ILogger defaultLogger) + { + return Logger ?? defaultLogger; + } + + public IEnumerable Parameters() => new List(InternalParameters()); + + public Actor? ParentOr(Actor? defaultParent) => Parent ?? defaultParent; + + internal IEnumerable InternalParameters() => _parameters; + + private static ISupervisor? AssignSupervisor(Actor? parent) + { + if (parent is ISupervisor) + { + return parent.LifeCycle.Environment.Stage.ActorAs(parent); + } + return null; + } + + public class SerializationProxy + { + public string ActorName { get; } + public string MailboxName { get; } + public IEnumerable Parameters { get; } + public ActorProxyStub Parent { get; } + public Type Type { get; } + public bool Evictable { get; } + + public static SerializationProxy From(Definition definition) => + new SerializationProxy( + definition.ActorName!, + definition.MailboxName!, + definition._parameters!, + definition.Parent != null ? new ActorProxyStub(definition.Parent) : null!, + definition.Type!, + definition.Evictable); + + public SerializationProxy( + string actorName, + string mailboxName, + IEnumerable parameters, + ActorProxyStub parent, + Type type, + bool evictable) + { + ActorName = actorName; + MailboxName = mailboxName; + Parameters = parameters; + Parent = parent; + Type = type; + Evictable = evictable; + } + + public override bool Equals(object? obj) + { + if (this == obj) + { + return true; + } + if (obj == null || GetType() != obj.GetType()) + { + return false; + } + + var that = (SerializationProxy) obj; + + return ActorName == that.ActorName + && MailboxName == that.MailboxName + && Equals(Parameters, that.Parameters) + && Parent == that.Parent + && Type == that.Type; + } + + public override int GetHashCode() => + 31 * ActorName.GetHashCode() + MailboxName.GetHashCode() + GetHashCode(Parameters) + + Parent.GetHashCode() + Type.GetHashCode(); + + public override string ToString() => $"Definition(ActorName='{ActorName}', MailboxName='{MailboxName}', Parameters='{Parameters.Select(p => p.ToString())}', Parent='{Parent}', type='{Type}')"; + + private bool Equals(IEnumerable? p1, IEnumerable? p2) + { + if (p1 == null || p2 == null) + { + return false; + } + + var parameters1 = p1.ToList(); + var parameters2 = p2.ToList(); + + var count1 = parameters1.Count; + var count2 = parameters2.Count; + if (count1 != count2) + { + return false; + } + + for (var i = 0; i < count1; i++) + { + if (!parameters1[i].Equals(parameters2[i])) + { + return false; + } + } + + return true; + } + + private int GetHashCode(IEnumerable parameters) + { + var hashCode = 0; + foreach (var parameter in parameters) + { + if (hashCode == 0) + { + hashCode += 31 * parameter.GetHashCode(); + } + + hashCode += parameter.GetHashCode(); + } + + return hashCode; + } + } + } } \ No newline at end of file diff --git a/src/Vlingo.Actors/Directory.cs b/src/Vlingo.Xoom.Actors/Directory.cs similarity index 100% rename from src/Vlingo.Actors/Directory.cs rename to src/Vlingo.Xoom.Actors/Directory.cs diff --git a/src/Vlingo.Actors/DirectoryEvictor.cs b/src/Vlingo.Xoom.Actors/DirectoryEvictor.cs similarity index 100% rename from src/Vlingo.Actors/DirectoryEvictor.cs rename to src/Vlingo.Xoom.Actors/DirectoryEvictor.cs diff --git a/src/Vlingo.Actors/DirectoryScannerActor.cs b/src/Vlingo.Xoom.Actors/DirectoryScannerActor.cs similarity index 100% rename from src/Vlingo.Actors/DirectoryScannerActor.cs rename to src/Vlingo.Xoom.Actors/DirectoryScannerActor.cs diff --git a/src/Vlingo.Actors/DirectoryScanner__Proxy.cs b/src/Vlingo.Xoom.Actors/DirectoryScanner__Proxy.cs similarity index 97% rename from src/Vlingo.Actors/DirectoryScanner__Proxy.cs rename to src/Vlingo.Xoom.Actors/DirectoryScanner__Proxy.cs index 87328892..3f130151 100644 --- a/src/Vlingo.Actors/DirectoryScanner__Proxy.cs +++ b/src/Vlingo.Xoom.Actors/DirectoryScanner__Proxy.cs @@ -12,8 +12,8 @@ namespace Vlingo.Actors { public class DirectoryScanner__Proxy : IDirectoryScanner { - private const string ActorOfRepresentation1 = "ActorOf(Vlingo.Actors.Address)"; - private const string ActorOfRepresentation2 = "MaybeActorOf(Vlingo.Actors.Address)"; + private const string ActorOfRepresentation1 = "ActorOf(Vlingo.Xoom.Actors.Address)"; + private const string ActorOfRepresentation2 = "MaybeActorOf(Vlingo.Xoom.Actors.Address)"; private readonly Actor _actor; private readonly IMailbox _mailbox; diff --git a/src/Vlingo.Actors/Environment.cs b/src/Vlingo.Xoom.Actors/Environment.cs similarity index 97% rename from src/Vlingo.Actors/Environment.cs rename to src/Vlingo.Xoom.Actors/Environment.cs index 21fe0cba..f9a8057b 100644 --- a/src/Vlingo.Actors/Environment.cs +++ b/src/Vlingo.Xoom.Actors/Environment.cs @@ -1,153 +1,153 @@ -// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using Vlingo.Xoom.Common; - -namespace Vlingo.Actors -{ - public class Environment - { - internal IAddress Address { get; } - internal ConcurrentDictionary Children { get; } - internal IAddress? CompletesEventuallyAddress { get; private set; } - internal Definition Definition { get; } - internal FailureMark FailureMark { get; } - - internal ILogger Logger { get; } - internal IMailbox Mailbox { get; } - internal ISupervisor? MaybeSupervisor { get; } - internal Actor? Parent { get; } - private IDictionary ProxyCache { get; } - internal Stage Stage { get; } - internal Stowage Stowage { get; } - internal Stowage Suspended { get; } - - private readonly AtomicBoolean _secured; - private readonly AtomicBoolean _stopped; - private Type[]? _stowageOverrides; - - public static Environment Of(Actor actor) => actor.LifeCycle.Environment; - - public int PendingMessages => Mailbox.PendingMessages; - - protected internal Environment( - Stage stage, - IAddress address, - Definition definition, - Actor? parent, - IMailbox mailbox, - ISupervisor? maybeSupervisor, - ILogger logger) - { - Stage = stage ?? throw new ArgumentNullException(nameof(stage)); - Address = address ?? throw new ArgumentNullException(nameof(address)); - Definition = definition ?? throw new ArgumentNullException(nameof(definition)); - if (address.Id != World.PrivateRootId) - { - Parent = parent ?? throw new ArgumentNullException(nameof(parent)); - } - else - { - Parent = parent; - } - Mailbox = mailbox ?? throw new ArgumentNullException(nameof(mailbox)); - MaybeSupervisor = maybeSupervisor; - FailureMark = new FailureMark(); - Logger = logger; - Children = new ConcurrentDictionary(); - ProxyCache = new Dictionary(1); - Stowage = new Stowage(); - _stowageOverrides = null; - Suspended = new Stowage(); - - _secured = new AtomicBoolean(false); - _stopped = new AtomicBoolean(false); - } - - internal void AddChild(Actor child) => Children.AddOrUpdate(child.Address.Id, _ => child, (id, _) => child); - - internal void RemoveChild(Actor child) => Children.TryRemove(child.Address.Id, out _); - - internal ICompletesEventually CompletesEventually(ResultCompletes completes) - { - if (CompletesEventuallyAddress == null) - { - var completesEventually = Stage.World.CompletesFor(completes.ClientCompletes()); - CompletesEventuallyAddress = completesEventually.Address; - return completesEventually; - } - - return Stage.World.CompletesFor(CompletesEventuallyAddress, completes.ClientCompletes()); - } - - internal void CacheProxy(T proxy) - { - if (proxy != null) ProxyCache[proxy.GetType()] = proxy; - } - - internal void CacheProxy(Type proxyType, object proxy) => ProxyCache[proxyType] = proxy; - - internal T LookUpProxy() - { - var lookup = LookUpProxy(typeof(T)); - if (lookup != null && !lookup.Equals(null)) - { - return (T) lookup; - } - - return default!; - } - - internal object? LookUpProxy(Type type) - => ProxyCache.ContainsKey(type) ? ProxyCache[type] : null; - - internal bool IsSecured => _secured.Get(); - - internal void SetSecured() => _secured.Set(true); - - internal void RemoveFromParent(Actor actor) => Parent?.LifeCycle.Environment.RemoveChild(actor); - - internal bool IsStopped => _stopped.Get(); - - internal void Stop() - { - if (_stopped.CompareAndSet(false, true)) - { - StopChildren(); - Suspended.Reset(); - Stowage.Reset(); - Mailbox.Close(); - } - } - - internal bool IsStowageOverride(Type protocol) - { - if (_stowageOverrides != null) - { - return _stowageOverrides.Contains(protocol); - } - - return false; - } - - internal void StowageOverrides(params Type[] overrides) => _stowageOverrides = overrides; - - private void StopChildren() - { - foreach (var idChildPair in Children) - { - idChildPair.Value.Stop(); - } - - Children.Clear(); - } - } -} +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using Vlingo.Xoom.Common; + +namespace Vlingo.Actors +{ + public class Environment + { + internal IAddress Address { get; } + internal ConcurrentDictionary Children { get; } + internal IAddress? CompletesEventuallyAddress { get; private set; } + internal Definition Definition { get; } + internal FailureMark FailureMark { get; } + + internal ILogger Logger { get; } + internal IMailbox Mailbox { get; } + internal ISupervisor? MaybeSupervisor { get; } + internal Actor? Parent { get; } + private IDictionary ProxyCache { get; } + internal Stage Stage { get; } + internal Stowage Stowage { get; } + internal Stowage Suspended { get; } + + private readonly AtomicBoolean _secured; + private readonly AtomicBoolean _stopped; + private Type[]? _stowageOverrides; + + public static Environment Of(Actor actor) => actor.LifeCycle.Environment; + + public int PendingMessages => Mailbox.PendingMessages; + + protected internal Environment( + Stage stage, + IAddress address, + Definition definition, + Actor? parent, + IMailbox mailbox, + ISupervisor? maybeSupervisor, + ILogger logger) + { + Stage = stage ?? throw new ArgumentNullException(nameof(stage)); + Address = address ?? throw new ArgumentNullException(nameof(address)); + Definition = definition ?? throw new ArgumentNullException(nameof(definition)); + if (address.Id != World.PrivateRootId) + { + Parent = parent ?? throw new ArgumentNullException(nameof(parent)); + } + else + { + Parent = parent; + } + Mailbox = mailbox ?? throw new ArgumentNullException(nameof(mailbox)); + MaybeSupervisor = maybeSupervisor; + FailureMark = new FailureMark(); + Logger = logger; + Children = new ConcurrentDictionary(); + ProxyCache = new Dictionary(1); + Stowage = new Stowage(); + _stowageOverrides = null; + Suspended = new Stowage(); + + _secured = new AtomicBoolean(false); + _stopped = new AtomicBoolean(false); + } + + internal void AddChild(Actor child) => Children.AddOrUpdate(child.Address.Id, _ => child, (id, _) => child); + + internal void RemoveChild(Actor child) => Children.TryRemove(child.Address.Id, out _); + + internal ICompletesEventually CompletesEventually(ResultCompletes completes) + { + if (CompletesEventuallyAddress == null) + { + var completesEventually = Stage.World.CompletesFor(completes.ClientCompletes()); + CompletesEventuallyAddress = completesEventually.Address; + return completesEventually; + } + + return Stage.World.CompletesFor(CompletesEventuallyAddress, completes.ClientCompletes()); + } + + internal void CacheProxy(T proxy) + { + if (proxy != null) ProxyCache[proxy.GetType()] = proxy; + } + + internal void CacheProxy(Type proxyType, object proxy) => ProxyCache[proxyType] = proxy; + + internal T LookUpProxy() + { + var lookup = LookUpProxy(typeof(T)); + if (lookup != null && !lookup.Equals(null)) + { + return (T) lookup; + } + + return default!; + } + + internal object? LookUpProxy(Type type) + => ProxyCache.ContainsKey(type) ? ProxyCache[type] : null; + + internal bool IsSecured => _secured.Get(); + + internal void SetSecured() => _secured.Set(true); + + internal void RemoveFromParent(Actor actor) => Parent?.LifeCycle.Environment.RemoveChild(actor); + + internal bool IsStopped => _stopped.Get(); + + internal void Stop() + { + if (_stopped.CompareAndSet(false, true)) + { + StopChildren(); + Suspended.Reset(); + Stowage.Reset(); + Mailbox.Close(); + } + } + + internal bool IsStowageOverride(Type protocol) + { + if (_stowageOverrides != null) + { + return _stowageOverrides.Contains(protocol); + } + + return false; + } + + internal void StowageOverrides(params Type[] overrides) => _stowageOverrides = overrides; + + private void StopChildren() + { + foreach (var idChildPair in Children) + { + idChildPair.Value.Stop(); + } + + Children.Clear(); + } + } +} diff --git a/src/Vlingo.Actors/Evictable.cs b/src/Vlingo.Xoom.Actors/Evictable.cs similarity index 100% rename from src/Vlingo.Actors/Evictable.cs rename to src/Vlingo.Xoom.Actors/Evictable.cs diff --git a/src/Vlingo.Actors/ExecutorDispatcherAsync.cs b/src/Vlingo.Xoom.Actors/ExecutorDispatcherAsync.cs similarity index 100% rename from src/Vlingo.Actors/ExecutorDispatcherAsync.cs rename to src/Vlingo.Xoom.Actors/ExecutorDispatcherAsync.cs diff --git a/src/Vlingo.Actors/ExpressionExtensions.cs b/src/Vlingo.Xoom.Actors/ExpressionExtensions.cs similarity index 100% rename from src/Vlingo.Actors/ExpressionExtensions.cs rename to src/Vlingo.Xoom.Actors/ExpressionExtensions.cs diff --git a/src/Vlingo.Actors/FailureMark.cs b/src/Vlingo.Xoom.Actors/FailureMark.cs similarity index 100% rename from src/Vlingo.Actors/FailureMark.cs rename to src/Vlingo.Xoom.Actors/FailureMark.cs diff --git a/src/Vlingo.Actors/GuidAddress.cs b/src/Vlingo.Xoom.Actors/GuidAddress.cs similarity index 100% rename from src/Vlingo.Actors/GuidAddress.cs rename to src/Vlingo.Xoom.Actors/GuidAddress.cs diff --git a/src/Vlingo.Actors/GuidAddressFactory.cs b/src/Vlingo.Xoom.Actors/GuidAddressFactory.cs similarity index 100% rename from src/Vlingo.Actors/GuidAddressFactory.cs rename to src/Vlingo.Xoom.Actors/GuidAddressFactory.cs diff --git a/src/Vlingo.Actors/IAddress.cs b/src/Vlingo.Xoom.Actors/IAddress.cs similarity index 100% rename from src/Vlingo.Actors/IAddress.cs rename to src/Vlingo.Xoom.Actors/IAddress.cs diff --git a/src/Vlingo.Actors/IAddressFactory.cs b/src/Vlingo.Xoom.Actors/IAddressFactory.cs similarity index 100% rename from src/Vlingo.Actors/IAddressFactory.cs rename to src/Vlingo.Xoom.Actors/IAddressFactory.cs diff --git a/src/Vlingo.Actors/IAddressable.cs b/src/Vlingo.Xoom.Actors/IAddressable.cs similarity index 100% rename from src/Vlingo.Actors/IAddressable.cs rename to src/Vlingo.Xoom.Actors/IAddressable.cs diff --git a/src/Vlingo.Actors/ICompletesEventually.cs b/src/Vlingo.Xoom.Actors/ICompletesEventually.cs similarity index 100% rename from src/Vlingo.Actors/ICompletesEventually.cs rename to src/Vlingo.Xoom.Actors/ICompletesEventually.cs diff --git a/src/Vlingo.Actors/ICompletesEventuallyProvider.cs b/src/Vlingo.Xoom.Actors/ICompletesEventuallyProvider.cs similarity index 100% rename from src/Vlingo.Actors/ICompletesEventuallyProvider.cs rename to src/Vlingo.Xoom.Actors/ICompletesEventuallyProvider.cs diff --git a/src/Vlingo.Actors/ICompletesEventuallyProviderKeeper.cs b/src/Vlingo.Xoom.Actors/ICompletesEventuallyProviderKeeper.cs similarity index 100% rename from src/Vlingo.Actors/ICompletesEventuallyProviderKeeper.cs rename to src/Vlingo.Xoom.Actors/ICompletesEventuallyProviderKeeper.cs diff --git a/src/Vlingo.Actors/IDeadLetters.cs b/src/Vlingo.Xoom.Actors/IDeadLetters.cs similarity index 100% rename from src/Vlingo.Actors/IDeadLetters.cs rename to src/Vlingo.Xoom.Actors/IDeadLetters.cs diff --git a/src/Vlingo.Actors/IDeadLettersListener.cs b/src/Vlingo.Xoom.Actors/IDeadLettersListener.cs similarity index 100% rename from src/Vlingo.Actors/IDeadLettersListener.cs rename to src/Vlingo.Xoom.Actors/IDeadLettersListener.cs diff --git a/src/Vlingo.Actors/IDirectoryScanner.cs b/src/Vlingo.Xoom.Actors/IDirectoryScanner.cs similarity index 100% rename from src/Vlingo.Actors/IDirectoryScanner.cs rename to src/Vlingo.Xoom.Actors/IDirectoryScanner.cs diff --git a/src/Vlingo.Actors/IDispatcher.cs b/src/Vlingo.Xoom.Actors/IDispatcher.cs similarity index 100% rename from src/Vlingo.Actors/IDispatcher.cs rename to src/Vlingo.Xoom.Actors/IDispatcher.cs diff --git a/src/Vlingo.Actors/ILogger.cs b/src/Vlingo.Xoom.Actors/ILogger.cs similarity index 100% rename from src/Vlingo.Actors/ILogger.cs rename to src/Vlingo.Xoom.Actors/ILogger.cs diff --git a/src/Vlingo.Actors/ILoggerProvider.cs b/src/Vlingo.Xoom.Actors/ILoggerProvider.cs similarity index 100% rename from src/Vlingo.Actors/ILoggerProvider.cs rename to src/Vlingo.Xoom.Actors/ILoggerProvider.cs diff --git a/src/Vlingo.Actors/ILoggerProviderKeeper.cs b/src/Vlingo.Xoom.Actors/ILoggerProviderKeeper.cs similarity index 100% rename from src/Vlingo.Actors/ILoggerProviderKeeper.cs rename to src/Vlingo.Xoom.Actors/ILoggerProviderKeeper.cs diff --git a/src/Vlingo.Actors/IMailbox.cs b/src/Vlingo.Xoom.Actors/IMailbox.cs similarity index 100% rename from src/Vlingo.Actors/IMailbox.cs rename to src/Vlingo.Xoom.Actors/IMailbox.cs diff --git a/src/Vlingo.Actors/IMailboxProvider.cs b/src/Vlingo.Xoom.Actors/IMailboxProvider.cs similarity index 100% rename from src/Vlingo.Actors/IMailboxProvider.cs rename to src/Vlingo.Xoom.Actors/IMailboxProvider.cs diff --git a/src/Vlingo.Actors/IMailboxProviderKeeper.cs b/src/Vlingo.Xoom.Actors/IMailboxProviderKeeper.cs similarity index 100% rename from src/Vlingo.Actors/IMailboxProviderKeeper.cs rename to src/Vlingo.Xoom.Actors/IMailboxProviderKeeper.cs diff --git a/src/Vlingo.Actors/IMessage.cs b/src/Vlingo.Xoom.Actors/IMessage.cs similarity index 100% rename from src/Vlingo.Actors/IMessage.cs rename to src/Vlingo.Xoom.Actors/IMessage.cs diff --git a/src/Vlingo.Actors/INoProtocol.cs b/src/Vlingo.Xoom.Actors/INoProtocol.cs similarity index 100% rename from src/Vlingo.Actors/INoProtocol.cs rename to src/Vlingo.Xoom.Actors/INoProtocol.cs diff --git a/src/Vlingo.Actors/IRegistrar.cs b/src/Vlingo.Xoom.Actors/IRegistrar.cs similarity index 100% rename from src/Vlingo.Actors/IRegistrar.cs rename to src/Vlingo.Xoom.Actors/IRegistrar.cs diff --git a/src/Vlingo.Actors/IRelocatable.cs b/src/Vlingo.Xoom.Actors/IRelocatable.cs similarity index 100% rename from src/Vlingo.Actors/IRelocatable.cs rename to src/Vlingo.Xoom.Actors/IRelocatable.cs diff --git a/src/Vlingo.Actors/ISafeProxyGenerable.cs b/src/Vlingo.Xoom.Actors/ISafeProxyGenerable.cs similarity index 100% rename from src/Vlingo.Actors/ISafeProxyGenerable.cs rename to src/Vlingo.Xoom.Actors/ISafeProxyGenerable.cs diff --git a/src/Vlingo.Actors/IStartable.cs b/src/Vlingo.Xoom.Actors/IStartable.cs similarity index 96% rename from src/Vlingo.Actors/IStartable.cs rename to src/Vlingo.Xoom.Actors/IStartable.cs index 365de28b..94a4d298 100644 --- a/src/Vlingo.Actors/IStartable.cs +++ b/src/Vlingo.Xoom.Actors/IStartable.cs @@ -1,14 +1,14 @@ -// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -namespace Vlingo.Actors -{ - public interface IStartable - { - void Start(); - } -} +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +namespace Vlingo.Actors +{ + public interface IStartable + { + void Start(); + } +} diff --git a/src/Vlingo.Actors/IStoppable.cs b/src/Vlingo.Xoom.Actors/IStoppable.cs similarity index 97% rename from src/Vlingo.Actors/IStoppable.cs rename to src/Vlingo.Xoom.Actors/IStoppable.cs index 9600213a..ff4f9a6e 100644 --- a/src/Vlingo.Actors/IStoppable.cs +++ b/src/Vlingo.Xoom.Actors/IStoppable.cs @@ -1,46 +1,46 @@ -// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -namespace Vlingo.Actors -{ - /// - /// Arranges for stopping the receiver. - /// - /// Note that the contract of stop() is to suspend the receivers mailbox - /// deliveries, which will prevent further processing. To arrange for - /// eventually stopping the receiver send Conclude(), which will then - /// cause Stop(). In essence the Conclude() marks the mailbox for ending - /// operations, but allows messages already queued to first be delivered. - /// - /// - public interface IStoppable - { - /// - /// Concludes the receiver, eventually causing - /// it to receive a Stop() message. - /// - void Conclude(); - - /// - /// Answer whether or not the receiver is stopped. - /// - bool IsStopped { get; } - - /// - /// Causes the receiver to stop reacting to messages and to eventually - /// be garbage collected. - /// - /// Note that the contract of Stop() is to suspend the receivers mailbox - /// deliveries, which will prevent further processing. To arrange for - /// eventually stopping the receiver send Conclude(), which will then - /// cause Stop(). In essence the Conclude() marks the mailbox for ending - /// operations, but allows messages already queued to first be delivered. - /// - /// - void Stop(); - } +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +namespace Vlingo.Actors +{ + /// + /// Arranges for stopping the receiver. + /// + /// Note that the contract of stop() is to suspend the receivers mailbox + /// deliveries, which will prevent further processing. To arrange for + /// eventually stopping the receiver send Conclude(), which will then + /// cause Stop(). In essence the Conclude() marks the mailbox for ending + /// operations, but allows messages already queued to first be delivered. + /// + /// + public interface IStoppable + { + /// + /// Concludes the receiver, eventually causing + /// it to receive a Stop() message. + /// + void Conclude(); + + /// + /// Answer whether or not the receiver is stopped. + /// + bool IsStopped { get; } + + /// + /// Causes the receiver to stop reacting to messages and to eventually + /// be garbage collected. + /// + /// Note that the contract of Stop() is to suspend the receivers mailbox + /// deliveries, which will prevent further processing. To arrange for + /// eventually stopping the receiver send Conclude(), which will then + /// cause Stop(). In essence the Conclude() marks the mailbox for ending + /// operations, but allows messages already queued to first be delivered. + /// + /// + void Stop(); + } } \ No newline at end of file diff --git a/src/Vlingo.Actors/ISupervised.cs b/src/Vlingo.Xoom.Actors/ISupervised.cs similarity index 100% rename from src/Vlingo.Actors/ISupervised.cs rename to src/Vlingo.Xoom.Actors/ISupervised.cs diff --git a/src/Vlingo.Actors/ISupervisionStrategy.cs b/src/Vlingo.Xoom.Actors/ISupervisionStrategy.cs similarity index 100% rename from src/Vlingo.Actors/ISupervisionStrategy.cs rename to src/Vlingo.Xoom.Actors/ISupervisionStrategy.cs diff --git a/src/Vlingo.Actors/ISupervisor.cs b/src/Vlingo.Xoom.Actors/ISupervisor.cs similarity index 100% rename from src/Vlingo.Actors/ISupervisor.cs rename to src/Vlingo.Xoom.Actors/ISupervisor.cs diff --git a/src/Vlingo.Actors/InvalidProtocolException.cs b/src/Vlingo.Xoom.Actors/InvalidProtocolException.cs similarity index 100% rename from src/Vlingo.Actors/InvalidProtocolException.cs rename to src/Vlingo.Xoom.Actors/InvalidProtocolException.cs diff --git a/src/Vlingo.Actors/LifeCycle.cs b/src/Vlingo.Xoom.Actors/LifeCycle.cs similarity index 96% rename from src/Vlingo.Actors/LifeCycle.cs rename to src/Vlingo.Xoom.Actors/LifeCycle.cs index dc58e71b..cece5a0b 100644 --- a/src/Vlingo.Actors/LifeCycle.cs +++ b/src/Vlingo.Xoom.Actors/LifeCycle.cs @@ -1,172 +1,172 @@ -// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -using System; - -namespace Vlingo.Actors -{ - internal sealed class LifeCycle - { - internal Environment Environment { get; set; } - internal Evictable Evictable { get; set; } - - internal LifeCycle(Environment environment, Evictable evictable) - { - Environment = environment; - Evictable = evictable; - } - - public override int GetHashCode() => Address.GetHashCode(); - - internal IAddress Address => Environment.Address; - - internal Definition Definition - { - get - { - if (Environment.IsSecured) - { - throw new InvalidOperationException("A secured actor cannot provide its definition."); - } - - return Environment.Definition; - } - } - - internal T LookUpProxy() => Environment.LookUpProxy(); - - internal bool IsSecured => Environment.IsSecured; - - internal void Secure() - { - Environment.SetSecured(); - } - - internal bool IsStopped => Environment.IsStopped; - - internal void Stop(Actor actor) - { - Environment.Stop(); - AfterStop(actor); - Environment.RemoveFromParent(actor); - } - - #region Standard Lifecycle - internal void AfterStop(Actor actor) - { - try - { - actor.AfterStop(); - } - catch (Exception ex) - { - Environment.Logger.Error($"vlingo-net/actors: Actor AfterStop() failed: {ex.Message}", ex); - Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); - } - } - - internal void BeforeStart(Actor actor) - { - try - { - actor.BeforeStart(); - } - catch (Exception ex) - { - Environment.Logger.Error($"vlingo-net/actors: Actor BeforeStart() failed: {ex.Message}"); - Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); - } - } - - internal void AfterRestart(Actor actor, Exception reason) - { - try - { - actor.AfterRestart(reason); - } - catch (Exception ex) - { - Environment.Logger.Error($"vlingo-net/actors: Actor AfterRestart() failed: {ex.Message}"); - Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); - } - } - - internal void BeforeRestart(Actor actor, Exception reason) - { - try - { - actor.BeforeRestart(reason); - } - catch (Exception ex) - { - Environment.Logger.Error($"vlingo-net/actors: Actor BeforeRestart() failed: {ex.Message}"); - Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); - } - } - - internal void BeforeResume(Actor actor, Exception reason) - { - try - { - actor.BeforeResume(reason); - } - catch (Exception ex) - { - Environment.Logger.Error($"vlingo-net/actors: Actor BeforeResume() failed: {ex.Message}"); - Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); - } - } - - internal void SendStart(Actor targetActor) - { - try - { - Action consumer = x => x.Start(); - if (!Environment.Mailbox.IsPreallocated) - { - var message = new LocalMessage(targetActor, consumer, "Start()"); - Environment.Mailbox.Send(message); - } - else - { - Environment.Mailbox.Send(targetActor, consumer, null, "Start()"); - } - } - catch (Exception ex) - { - Environment.Logger.Error("vlingo-net/actors: Actor Start() failed: {ex.Message}"); - Environment.Stage.HandleFailureOf(new StageSupervisedActor(targetActor, ex)); - } - } - - #endregion - - #region supervisor/suspending/resuming - - internal void Resume() => Environment.Mailbox.Resume(Mailbox.Exceptional); - - internal bool IsSuspended => Environment.Mailbox.IsSuspended; - - internal void Suspend() => Environment.Mailbox.SuspendExceptFor(Mailbox.Exceptional, typeof(IStoppable)); - - internal void SuspendForStop() => Environment.Mailbox.SuspendExceptFor(Mailbox.Stopping, typeof(IStoppable)); - - internal ISupervisor Supervisor() - { - var supervisor = Environment.MaybeSupervisor; - - if (supervisor == null) - { - supervisor = Environment.Stage.CommonSupervisorOr(Environment.Stage.World.DefaultSupervisor); - } - - return supervisor; - } - - #endregion - } +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +using System; + +namespace Vlingo.Actors +{ + internal sealed class LifeCycle + { + internal Environment Environment { get; set; } + internal Evictable Evictable { get; set; } + + internal LifeCycle(Environment environment, Evictable evictable) + { + Environment = environment; + Evictable = evictable; + } + + public override int GetHashCode() => Address.GetHashCode(); + + internal IAddress Address => Environment.Address; + + internal Definition Definition + { + get + { + if (Environment.IsSecured) + { + throw new InvalidOperationException("A secured actor cannot provide its definition."); + } + + return Environment.Definition; + } + } + + internal T LookUpProxy() => Environment.LookUpProxy(); + + internal bool IsSecured => Environment.IsSecured; + + internal void Secure() + { + Environment.SetSecured(); + } + + internal bool IsStopped => Environment.IsStopped; + + internal void Stop(Actor actor) + { + Environment.Stop(); + AfterStop(actor); + Environment.RemoveFromParent(actor); + } + + #region Standard Lifecycle + internal void AfterStop(Actor actor) + { + try + { + actor.AfterStop(); + } + catch (Exception ex) + { + Environment.Logger.Error($"vlingo-net/actors: Actor AfterStop() failed: {ex.Message}", ex); + Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); + } + } + + internal void BeforeStart(Actor actor) + { + try + { + actor.BeforeStart(); + } + catch (Exception ex) + { + Environment.Logger.Error($"vlingo-net/actors: Actor BeforeStart() failed: {ex.Message}"); + Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); + } + } + + internal void AfterRestart(Actor actor, Exception reason) + { + try + { + actor.AfterRestart(reason); + } + catch (Exception ex) + { + Environment.Logger.Error($"vlingo-net/actors: Actor AfterRestart() failed: {ex.Message}"); + Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); + } + } + + internal void BeforeRestart(Actor actor, Exception reason) + { + try + { + actor.BeforeRestart(reason); + } + catch (Exception ex) + { + Environment.Logger.Error($"vlingo-net/actors: Actor BeforeRestart() failed: {ex.Message}"); + Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); + } + } + + internal void BeforeResume(Actor actor, Exception reason) + { + try + { + actor.BeforeResume(reason); + } + catch (Exception ex) + { + Environment.Logger.Error($"vlingo-net/actors: Actor BeforeResume() failed: {ex.Message}"); + Environment.Stage.HandleFailureOf(new StageSupervisedActor(actor, ex)); + } + } + + internal void SendStart(Actor targetActor) + { + try + { + Action consumer = x => x.Start(); + if (!Environment.Mailbox.IsPreallocated) + { + var message = new LocalMessage(targetActor, consumer, "Start()"); + Environment.Mailbox.Send(message); + } + else + { + Environment.Mailbox.Send(targetActor, consumer, null, "Start()"); + } + } + catch (Exception ex) + { + Environment.Logger.Error("vlingo-net/actors: Actor Start() failed: {ex.Message}"); + Environment.Stage.HandleFailureOf(new StageSupervisedActor(targetActor, ex)); + } + } + + #endregion + + #region supervisor/suspending/resuming + + internal void Resume() => Environment.Mailbox.Resume(Mailbox.Exceptional); + + internal bool IsSuspended => Environment.Mailbox.IsSuspended; + + internal void Suspend() => Environment.Mailbox.SuspendExceptFor(Mailbox.Exceptional, typeof(IStoppable)); + + internal void SuspendForStop() => Environment.Mailbox.SuspendExceptFor(Mailbox.Stopping, typeof(IStoppable)); + + internal ISupervisor Supervisor() + { + var supervisor = Environment.MaybeSupervisor; + + if (supervisor == null) + { + supervisor = Environment.Stage.CommonSupervisorOr(Environment.Stage.World.DefaultSupervisor); + } + + return supervisor; + } + + #endregion + } } \ No newline at end of file diff --git a/src/Vlingo.Actors/LocalMessage.cs b/src/Vlingo.Xoom.Actors/LocalMessage.cs similarity index 100% rename from src/Vlingo.Actors/LocalMessage.cs rename to src/Vlingo.Xoom.Actors/LocalMessage.cs diff --git a/src/Vlingo.Actors/LocalMessageAsync.cs b/src/Vlingo.Xoom.Actors/LocalMessageAsync.cs similarity index 100% rename from src/Vlingo.Actors/LocalMessageAsync.cs rename to src/Vlingo.Xoom.Actors/LocalMessageAsync.cs diff --git a/src/Vlingo.Actors/Logger__Proxy.cs b/src/Vlingo.Xoom.Actors/Logger__Proxy.cs similarity index 99% rename from src/Vlingo.Actors/Logger__Proxy.cs rename to src/Vlingo.Xoom.Actors/Logger__Proxy.cs index 121e2927..8b4f7701 100644 --- a/src/Vlingo.Actors/Logger__Proxy.cs +++ b/src/Vlingo.Xoom.Actors/Logger__Proxy.cs @@ -28,11 +28,11 @@ public class Logger__Proxy : ILogger private const string ErrorRepresentation14 = "Error(string)"; private const string ErrorRepresentation15 = "Error(string, System.Object[])"; private const string ErrorRepresentation16 = "Error(string, System.Exception)"; - private const string TraceRepresentation17 = "Trace(Vlingo.Actors.Logging.LogEvent)"; - private const string DebugRepresentation18 = "Debug(Vlingo.Actors.Logging.LogEvent)"; - private const string InfoRepresentation19 = "Info(Vlingo.Actors.Logging.LogEvent)"; - private const string WarnRepresentation20 = "Warn(Vlingo.Actors.Logging.LogEvent)"; - private const string ErrorRepresentation21 = "Error(Vlingo.Actors.Logging.LogEvent)"; + private const string TraceRepresentation17 = "Trace(Vlingo.Xoom.Actors.Logging.LogEvent)"; + private const string DebugRepresentation18 = "Debug(Vlingo.Xoom.Actors.Logging.LogEvent)"; + private const string InfoRepresentation19 = "Info(Vlingo.Xoom.Actors.Logging.LogEvent)"; + private const string WarnRepresentation20 = "Warn(Vlingo.Xoom.Actors.Logging.LogEvent)"; + private const string ErrorRepresentation21 = "Error(Vlingo.Xoom.Actors.Logging.LogEvent)"; private readonly Actor _actor; private readonly IMailbox _mailbox; diff --git a/src/Vlingo.Actors/NoProtocol__Proxy.cs b/src/Vlingo.Xoom.Actors/NoProtocol__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/NoProtocol__Proxy.cs rename to src/Vlingo.Xoom.Actors/NoProtocol__Proxy.cs diff --git a/src/Vlingo.Actors/Plugin/AbstractPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/AbstractPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/AbstractPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/AbstractPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/Completes/CompletesEventuallyPool.cs b/src/Vlingo.Xoom.Actors/Plugin/Completes/CompletesEventuallyPool.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Completes/CompletesEventuallyPool.cs rename to src/Vlingo.Xoom.Actors/Plugin/Completes/CompletesEventuallyPool.cs diff --git a/src/Vlingo.Actors/Plugin/Completes/DefaultCompletesEventuallyProviderKeeper.cs b/src/Vlingo.Xoom.Actors/Plugin/Completes/DefaultCompletesEventuallyProviderKeeper.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Completes/DefaultCompletesEventuallyProviderKeeper.cs rename to src/Vlingo.Xoom.Actors/Plugin/Completes/DefaultCompletesEventuallyProviderKeeper.cs diff --git a/src/Vlingo.Actors/Plugin/Completes/PooledCompletesPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Completes/PooledCompletesPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Completes/PooledCompletesPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Completes/PooledCompletesPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/Completes/PooledCompletesPluginConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/Completes/PooledCompletesPluginConfiguration.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Completes/PooledCompletesPluginConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/Completes/PooledCompletesPluginConfiguration.cs diff --git a/src/Vlingo.Actors/Plugin/Eviction/DirectoryEvictionConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/Eviction/DirectoryEvictionConfiguration.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Eviction/DirectoryEvictionConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/Eviction/DirectoryEvictionConfiguration.cs diff --git a/src/Vlingo.Actors/Plugin/Eviction/DirectoryEvictionPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Eviction/DirectoryEvictionPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Eviction/DirectoryEvictionPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Eviction/DirectoryEvictionPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/IPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/IPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/IPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/IPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/IPluginConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/IPluginConfiguration.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/IPluginConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/IPluginConfiguration.cs diff --git a/src/Vlingo.Actors/Plugin/Logging/Console/ConsoleLogger.cs b/src/Vlingo.Xoom.Actors/Plugin/Logging/Console/ConsoleLogger.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Logging/Console/ConsoleLogger.cs rename to src/Vlingo.Xoom.Actors/Plugin/Logging/Console/ConsoleLogger.cs diff --git a/src/Vlingo.Actors/Plugin/Logging/Console/ConsoleLoggerActor.cs b/src/Vlingo.Xoom.Actors/Plugin/Logging/Console/ConsoleLoggerActor.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Logging/Console/ConsoleLoggerActor.cs rename to src/Vlingo.Xoom.Actors/Plugin/Logging/Console/ConsoleLoggerActor.cs diff --git a/src/Vlingo.Actors/Plugin/Logging/Console/ConsoleLoggerPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Logging/Console/ConsoleLoggerPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Logging/Console/ConsoleLoggerPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Logging/Console/ConsoleLoggerPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/Logging/Console/ConsoleLoggerPluginConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/Logging/Console/ConsoleLoggerPluginConfiguration.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Logging/Console/ConsoleLoggerPluginConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/Logging/Console/ConsoleLoggerPluginConfiguration.cs diff --git a/src/Vlingo.Actors/Plugin/Logging/DefaultLoggerProviderKeeper.cs b/src/Vlingo.Xoom.Actors/Plugin/Logging/DefaultLoggerProviderKeeper.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Logging/DefaultLoggerProviderKeeper.cs rename to src/Vlingo.Xoom.Actors/Plugin/Logging/DefaultLoggerProviderKeeper.cs diff --git a/src/Vlingo.Actors/Plugin/Logging/LogEvent.cs b/src/Vlingo.Xoom.Actors/Plugin/Logging/LogEvent.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Logging/LogEvent.cs rename to src/Vlingo.Xoom.Actors/Plugin/Logging/LogEvent.cs diff --git a/src/Vlingo.Actors/Plugin/Logging/NoOp/NoOpLogger.cs b/src/Vlingo.Xoom.Actors/Plugin/Logging/NoOp/NoOpLogger.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Logging/NoOp/NoOpLogger.cs rename to src/Vlingo.Xoom.Actors/Plugin/Logging/NoOp/NoOpLogger.cs diff --git a/src/Vlingo.Actors/Plugin/Logging/NoOp/NoOpLoggerProvider.cs b/src/Vlingo.Xoom.Actors/Plugin/Logging/NoOp/NoOpLoggerProvider.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Logging/NoOp/NoOpLoggerProvider.cs rename to src/Vlingo.Xoom.Actors/Plugin/Logging/NoOp/NoOpLoggerProvider.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcher.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcher.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcher.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueDispatcher.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailbox.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailbox.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailbox.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueueMailbox.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePlugin.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePluginConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePluginConfiguration.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePluginConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/AgronaMPSCArrayQueue/ManyToOneConcurrentArrayQueuePluginConfiguration.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailbox.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailbox.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailbox.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailbox.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPluginConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPluginConfiguration.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPluginConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ConcurrentQueueMailboxPluginConfiguration.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcher.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcher.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcher.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ExecutorDispatcher.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ThreadPoolExecutor.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ThreadPoolExecutor.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/ConcurrentQueue/ThreadPoolExecutor.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/ConcurrentQueue/ThreadPoolExecutor.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeper.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeper.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeper.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeper.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeperPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeperPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeperPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeperPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginConfiguration.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/DefaultMailboxProviderKeeperPluginConfiguration.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcher.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcher.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcher.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/SharedRingBuffer/RingBufferDispatcher.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailbox.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailbox.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailbox.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailbox.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPluginConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPluginConfiguration.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPluginConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/SharedRingBuffer/SharedRingBufferMailboxPluginConfiguration.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/TestKit/TestMailbox.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/TestKit/TestMailbox.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/TestKit/TestMailbox.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/TestKit/TestMailbox.cs diff --git a/src/Vlingo.Actors/Plugin/Mailbox/TestKit/TestMailboxPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Mailbox/TestKit/TestMailboxPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Mailbox/TestKit/TestMailboxPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Mailbox/TestKit/TestMailboxPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/PluginLoader.cs b/src/Vlingo.Xoom.Actors/Plugin/PluginLoader.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/PluginLoader.cs rename to src/Vlingo.Xoom.Actors/Plugin/PluginLoader.cs diff --git a/src/Vlingo.Actors/Plugin/PluginProperties.cs b/src/Vlingo.Xoom.Actors/Plugin/PluginProperties.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/PluginProperties.cs rename to src/Vlingo.Xoom.Actors/Plugin/PluginProperties.cs diff --git a/src/Vlingo.Actors/Plugin/Supervision/CommonSupervisorsPlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Supervision/CommonSupervisorsPlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Supervision/CommonSupervisorsPlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Supervision/CommonSupervisorsPlugin.cs diff --git a/src/Vlingo.Actors/Plugin/Supervision/CommonSupervisorsPluginConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/Supervision/CommonSupervisorsPluginConfiguration.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Supervision/CommonSupervisorsPluginConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/Supervision/CommonSupervisorsPluginConfiguration.cs diff --git a/src/Vlingo.Actors/Plugin/Supervision/ConfiguredSupervisor.cs b/src/Vlingo.Xoom.Actors/Plugin/Supervision/ConfiguredSupervisor.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Supervision/ConfiguredSupervisor.cs rename to src/Vlingo.Xoom.Actors/Plugin/Supervision/ConfiguredSupervisor.cs diff --git a/src/Vlingo.Actors/Plugin/Supervision/DefaultSupervisorOverride.cs b/src/Vlingo.Xoom.Actors/Plugin/Supervision/DefaultSupervisorOverride.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Supervision/DefaultSupervisorOverride.cs rename to src/Vlingo.Xoom.Actors/Plugin/Supervision/DefaultSupervisorOverride.cs diff --git a/src/Vlingo.Actors/Plugin/Supervision/DefaultSupervisorOverridePlugin.cs b/src/Vlingo.Xoom.Actors/Plugin/Supervision/DefaultSupervisorOverridePlugin.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Supervision/DefaultSupervisorOverridePlugin.cs rename to src/Vlingo.Xoom.Actors/Plugin/Supervision/DefaultSupervisorOverridePlugin.cs diff --git a/src/Vlingo.Actors/Plugin/Supervision/DefaultSupervisorOverridePluginConfiguration.cs b/src/Vlingo.Xoom.Actors/Plugin/Supervision/DefaultSupervisorOverridePluginConfiguration.cs similarity index 94% rename from src/Vlingo.Actors/Plugin/Supervision/DefaultSupervisorOverridePluginConfiguration.cs rename to src/Vlingo.Xoom.Actors/Plugin/Supervision/DefaultSupervisorOverridePluginConfiguration.cs index 5bc0cd3e..9082d5f4 100644 --- a/src/Vlingo.Actors/Plugin/Supervision/DefaultSupervisorOverridePluginConfiguration.cs +++ b/src/Vlingo.Xoom.Actors/Plugin/Supervision/DefaultSupervisorOverridePluginConfiguration.cs @@ -45,7 +45,7 @@ public void Build(Configuration configuration) configuration.With(WithSupervisor( "default", "overrideSupervisor", - ConfiguredSupervisor.SupervisorFrom("Vlingo.Actors.Plugin.Supervision.DefaultSupervisorOverride"))); + ConfiguredSupervisor.SupervisorFrom("Vlingo.Xoom.Actors.Plugin.Supervision.DefaultSupervisorOverride"))); } public void BuildWith(Configuration configuration, PluginProperties properties) diff --git a/src/Vlingo.Actors/Plugin/Supervision/DefinitionValues.cs b/src/Vlingo.Xoom.Actors/Plugin/Supervision/DefinitionValues.cs similarity index 100% rename from src/Vlingo.Actors/Plugin/Supervision/DefinitionValues.cs rename to src/Vlingo.Xoom.Actors/Plugin/Supervision/DefinitionValues.cs diff --git a/src/Vlingo.Actors/PooledCompletes.cs b/src/Vlingo.Xoom.Actors/PooledCompletes.cs similarity index 100% rename from src/Vlingo.Actors/PooledCompletes.cs rename to src/Vlingo.Xoom.Actors/PooledCompletes.cs diff --git a/src/Vlingo.Actors/PrivateRootActor.cs b/src/Vlingo.Xoom.Actors/PrivateRootActor.cs similarity index 100% rename from src/Vlingo.Actors/PrivateRootActor.cs rename to src/Vlingo.Xoom.Actors/PrivateRootActor.cs diff --git a/src/Vlingo.Actors/Properties.cs b/src/Vlingo.Xoom.Actors/Properties.cs similarity index 100% rename from src/Vlingo.Actors/Properties.cs rename to src/Vlingo.Xoom.Actors/Properties.cs diff --git a/src/Vlingo.Actors/Protocols.cs b/src/Vlingo.Xoom.Actors/Protocols.cs similarity index 100% rename from src/Vlingo.Actors/Protocols.cs rename to src/Vlingo.Xoom.Actors/Protocols.cs diff --git a/src/Vlingo.Actors/ProxyGenerator.cs b/src/Vlingo.Xoom.Actors/ProxyGenerator.cs similarity index 100% rename from src/Vlingo.Actors/ProxyGenerator.cs rename to src/Vlingo.Xoom.Actors/ProxyGenerator.cs diff --git a/src/Vlingo.Actors/PubSub/AffectedSubscriptions.cs b/src/Vlingo.Xoom.Actors/PubSub/AffectedSubscriptions.cs similarity index 100% rename from src/Vlingo.Actors/PubSub/AffectedSubscriptions.cs rename to src/Vlingo.Xoom.Actors/PubSub/AffectedSubscriptions.cs diff --git a/src/Vlingo.Actors/PubSub/Condition.cs b/src/Vlingo.Xoom.Actors/PubSub/Condition.cs similarity index 100% rename from src/Vlingo.Actors/PubSub/Condition.cs rename to src/Vlingo.Xoom.Actors/PubSub/Condition.cs diff --git a/src/Vlingo.Actors/PubSub/DefaultPublisher.cs b/src/Vlingo.Xoom.Actors/PubSub/DefaultPublisher.cs similarity index 100% rename from src/Vlingo.Actors/PubSub/DefaultPublisher.cs rename to src/Vlingo.Xoom.Actors/PubSub/DefaultPublisher.cs diff --git a/src/Vlingo.Actors/PubSub/IMessage.cs b/src/Vlingo.Xoom.Actors/PubSub/IMessage.cs similarity index 100% rename from src/Vlingo.Actors/PubSub/IMessage.cs rename to src/Vlingo.Xoom.Actors/PubSub/IMessage.cs diff --git a/src/Vlingo.Actors/PubSub/IPublisher.cs b/src/Vlingo.Xoom.Actors/PubSub/IPublisher.cs similarity index 100% rename from src/Vlingo.Actors/PubSub/IPublisher.cs rename to src/Vlingo.Xoom.Actors/PubSub/IPublisher.cs diff --git a/src/Vlingo.Actors/PubSub/ISubscriber.cs b/src/Vlingo.Xoom.Actors/PubSub/ISubscriber.cs similarity index 100% rename from src/Vlingo.Actors/PubSub/ISubscriber.cs rename to src/Vlingo.Xoom.Actors/PubSub/ISubscriber.cs diff --git a/src/Vlingo.Actors/PubSub/Operation.cs b/src/Vlingo.Xoom.Actors/PubSub/Operation.cs similarity index 100% rename from src/Vlingo.Actors/PubSub/Operation.cs rename to src/Vlingo.Xoom.Actors/PubSub/Operation.cs diff --git a/src/Vlingo.Actors/PubSub/Subscriptions.cs b/src/Vlingo.Xoom.Actors/PubSub/Subscriptions.cs similarity index 100% rename from src/Vlingo.Actors/PubSub/Subscriptions.cs rename to src/Vlingo.Xoom.Actors/PubSub/Subscriptions.cs diff --git a/src/Vlingo.Actors/PubSub/Topic.cs b/src/Vlingo.Xoom.Actors/PubSub/Topic.cs similarity index 100% rename from src/Vlingo.Actors/PubSub/Topic.cs rename to src/Vlingo.Xoom.Actors/PubSub/Topic.cs diff --git a/src/Vlingo.Actors/PublicRootActor.cs b/src/Vlingo.Xoom.Actors/PublicRootActor.cs similarity index 100% rename from src/Vlingo.Actors/PublicRootActor.cs rename to src/Vlingo.Xoom.Actors/PublicRootActor.cs diff --git a/src/Vlingo.Actors/RandomRouter.cs b/src/Vlingo.Xoom.Actors/RandomRouter.cs similarity index 100% rename from src/Vlingo.Actors/RandomRouter.cs rename to src/Vlingo.Xoom.Actors/RandomRouter.cs diff --git a/src/Vlingo.Actors/ResultCompletes.cs b/src/Vlingo.Xoom.Actors/ResultCompletes.cs similarity index 100% rename from src/Vlingo.Actors/ResultCompletes.cs rename to src/Vlingo.Xoom.Actors/ResultCompletes.cs diff --git a/src/Vlingo.Actors/ResumingMailbox.cs b/src/Vlingo.Xoom.Actors/ResumingMailbox.cs similarity index 100% rename from src/Vlingo.Actors/ResumingMailbox.cs rename to src/Vlingo.Xoom.Actors/ResumingMailbox.cs diff --git a/src/Vlingo.Actors/RoundRobinRouter.cs b/src/Vlingo.Xoom.Actors/RoundRobinRouter.cs similarity index 100% rename from src/Vlingo.Actors/RoundRobinRouter.cs rename to src/Vlingo.Xoom.Actors/RoundRobinRouter.cs diff --git a/src/Vlingo.Actors/Routee.cs b/src/Vlingo.Xoom.Actors/Routee.cs similarity index 100% rename from src/Vlingo.Actors/Routee.cs rename to src/Vlingo.Xoom.Actors/Routee.cs diff --git a/src/Vlingo.Actors/Router.cs b/src/Vlingo.Xoom.Actors/Router.cs similarity index 100% rename from src/Vlingo.Actors/Router.cs rename to src/Vlingo.Xoom.Actors/Router.cs diff --git a/src/Vlingo.Actors/RouterSpecification.cs b/src/Vlingo.Xoom.Actors/RouterSpecification.cs similarity index 100% rename from src/Vlingo.Actors/RouterSpecification.cs rename to src/Vlingo.Xoom.Actors/RouterSpecification.cs diff --git a/src/Vlingo.Actors/Routing.cs b/src/Vlingo.Xoom.Actors/Routing.cs similarity index 100% rename from src/Vlingo.Actors/Routing.cs rename to src/Vlingo.Xoom.Actors/Routing.cs diff --git a/src/Vlingo.Actors/Scheduled__Proxy.cs b/src/Vlingo.Xoom.Actors/Scheduled__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/Scheduled__Proxy.cs rename to src/Vlingo.Xoom.Actors/Scheduled__Proxy.cs diff --git a/src/Vlingo.Actors/SmallestMailboxRouter.cs b/src/Vlingo.Xoom.Actors/SmallestMailboxRouter.cs similarity index 100% rename from src/Vlingo.Actors/SmallestMailboxRouter.cs rename to src/Vlingo.Xoom.Actors/SmallestMailboxRouter.cs diff --git a/src/Vlingo.Actors/Stage.cs b/src/Vlingo.Xoom.Actors/Stage.cs similarity index 97% rename from src/Vlingo.Actors/Stage.cs rename to src/Vlingo.Xoom.Actors/Stage.cs index 0339fda3..6cf4623c 100644 --- a/src/Vlingo.Actors/Stage.cs +++ b/src/Vlingo.Xoom.Actors/Stage.cs @@ -1,865 +1,865 @@ -// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Threading; -using Vlingo.Actors.Plugin.Mailbox.TestKit; -using Vlingo.Actors.TestKit; -using Vlingo.Xoom.Common; - -namespace Vlingo.Actors -{ - public class Stage : IStoppable - { - private readonly IDictionary _commonSupervisors; - private readonly Directory _directory; - private IDirectoryScanner? _directoryScanner; - private readonly Scheduler _scheduler; - private readonly AtomicBoolean _stopped; - - /// - /// Initializes the new Stage of the World and with . (INTERNAL ONLY) - /// - /// The World parent of this Stage. - /// AddressFactory for a this Stage. - /// The string name of this Stage. - /// - /// Uses default capacity of 32x32. - /// - internal Stage(World world, IAddressFactory addressFactory, string name) : this(world, addressFactory, name, 32, 32) - { - } - - /// - /// Initializes the new Stage of the World and with . (INTERNAL ONLY) - /// and capacity of and . - /// - /// The World parent of this Stage - /// The AddressFactory to be used - /// the name of this Stage - /// The number of buckets - /// The initial number of elements in each bucket - internal Stage(World world, IAddressFactory addressFactory, string name, int directoryBuckets, int directoryInitialCapacity) - { - AddressFactory = addressFactory; - World = world; - Name = name; - _directory = new Directory(world.AddressFactory.None(), directoryBuckets, directoryInitialCapacity); - _commonSupervisors = new Dictionary(); - _scheduler = new Scheduler(); - _stopped = new AtomicBoolean(false); - } - - /// - /// Answers the protocol type as the means to message the backing Actor. - /// - /// The protocol. - /// The Actor that implements the protocol - /// The as - public T ActorAs(Actor actor) - => ActorProxyFor(actor, actor.LifeCycle.Environment.Mailbox); - - /// - /// Answers the T protocol of the newly created Actor that implements the protocol. - /// - /// The protocol type - /// The type of Actor to create - /// Constructor parameters for the Actor - /// - public T ActorFor(Type type, params object[] parameters) - => ActorFor(Definition.Has(type, parameters.ToList())); - - /// - /// Answers the protocol of the newly created Actor that implements the protocol. - /// - /// The protocol type. - /// The Definition used to initialize the newly created Actor. - /// The Actor as . - public T ActorFor(Definition definition) - => ActorFor( - definition, - definition.ParentOr(World.DefaultParent), - definition.Supervisor, - definition.LoggerOr(World.DefaultLogger)); - - public T ActorFor(Expression> factory) - => ActorFor(Definition.Has(factory)); - - public T ActorFor(Expression> factory, string actorName) - => ActorFor(Definition.Has(factory, actorName)); - - /// - /// Answers the protocol of the newly created Actor that implements the protocol and - /// that will be assigned the specific and . - /// - /// The protocol - /// The Definition used to initialize the newly created Actor. - /// The IAddress to assign to the newly created Actor. - /// The ILogger to assign to the newly created Actor. - /// The Actor as . - public T ActorFor(Definition definition, IAddress address, ILogger logger) - { - var actorAddress = AllocateAddress(definition, address); - var actorMailbox = AllocateMailbox(definition, actorAddress, null); - - var actor = ActorProtocolFor( - definition, - definition.ParentOr(World.DefaultParent), - actorAddress, - actorMailbox, - definition.Supervisor, - logger); - - return actor!.ProtocolActor; - } - - public T ActorFor(Expression> factory, IAddress address, ILogger logger) - => ActorFor(Definition.Has(factory), address, logger); - - /// - /// Answers the protocol of the newly created Actor that implements the protocol and - /// that will be assigned the specific . - /// - /// The protocol. - /// The Definition used to initialize the newly created Actor. - /// The ILogger to assign to the newly created Actor. - /// The Actor as . - public T ActorFor(Definition definition, ILogger logger) - => ActorFor( - definition, - definition.ParentOr(World.DefaultParent), - definition.Supervisor, - logger); - - public T ActorFor(Expression> factory, ILogger logger) - => ActorFor(Definition.Has(factory), logger); - - /// - /// Answers the protocol of the newly created Actor that implements the protocol and - /// that will be assigned the specific . - /// - /// The protocol. - /// The Definition used to initialize the newly created Actor. - /// The IAddress to assign to the newly created Actor. - /// The Actor as . - public T ActorFor(Definition definition, IAddress address) - { - var actorAddress = AllocateAddress(definition, address); - var actorMailbox = AllocateMailbox(definition, actorAddress, null); - - var actor = ActorProtocolFor( - definition, - definition.ParentOr(World.DefaultParent), - actorAddress, - actorMailbox, - definition.Supervisor, - definition.LoggerOr(World.DefaultLogger)); - - return actor!.ProtocolActor; - } - - public T ActorThunkFor(Definition definition, IAddress? address) - { - var actorMailbox = AllocateMailbox(definition, address, null); - var actor = - ActorProtocolFor( - definition, - definition.ParentOr(World.DefaultParent), - address, - actorMailbox, - definition.Supervisor, - definition.LoggerOr(World.DefaultLogger)); - - return actor!.ProtocolActor; - } - - public T ActorFor(Expression> factory, IAddress address) - => ActorFor(Definition.Has(factory), address); - - public T ActorFor(Expression> factory, string mailboxName, string actorName) - => ActorFor(Definition.Has(factory, mailboxName, actorName)); - - public T ActorFor(Expression> factory, string mailboxName, string actorName, IAddress address, ILogger logger) - => ActorFor(Definition.Has(factory, mailboxName, actorName), address, logger); - - /// - /// Answers a Protocols that provides one or more supported for the - /// newly created Actor according to . - /// - /// Array of protocols that the Actor supports. - /// The definition providing parameters to the Actor. - /// The actor that is this actor's parent. - /// The possible supervisor of this actor. - /// The logger of this actor. - /// - public Protocols ActorFor(Type[] protocols, Definition definition, Actor parent, ISupervisor? maybeSupervisor, ILogger logger) - { - var all = ActorProtocolFor(protocols, definition, parent, maybeSupervisor, logger); - return new Protocols(ActorProtocolActor.ToActors(all)); - } - - /// - /// Answers a Protocols that provides one or more supported for the - /// newly created Actor according to . - /// - /// The array of protocol that the Actor supports. - /// The Definition providing parameters to the Actor. - /// A instance. - public Protocols ActorFor(Type[] protocols, Definition definition) - { - var all = ActorProtocolFor( - protocols, - definition, - definition.ParentOr(World.DefaultParent), - definition.Supervisor, - definition.LoggerOr(World.DefaultLogger)); - - return new Protocols(ActorProtocolActor.ToActors(all)); - } - - /// - /// Answers a Protocols that provides one or more supported for the - /// newly created Actor with the provided . - /// - /// The array of protocol that the Actor supports. - /// The type of the Actor to create. - /// The constructor parameters. - /// A instance. - public Protocols ActorFor(Type[] protocols, Type type, params object[] parameters) - => ActorFor(protocols, Definition.Has(type, parameters.ToList())); - - /// - /// Answers the ICompletes<T> that will eventually complete with the protocol - /// of the backing Actor of the given , or null if not found. - /// - /// The protocol supported by the backing Actor. - /// The IAddress of the Actor to find. - /// ICompletes<T> of the backing actor found by the address. null if not found. - public ICompletes ActorOf(IAddress address) => _directoryScanner!.ActorOf(address).AndThen(proxy => proxy); - - public IAddressFactory AddressFactory { get; } - - /// - /// Answer the protocol reference of the actor with as a non-empty - /// ICompletes<Optional<T>> eventual outcome, or an empty ICompletes<Optional<T>> - /// if not found. - /// - /// The protocol that the actor must support. - /// The address of the actor to find. - /// - public ICompletes> MaybeActorOf(IAddress address) - => _directoryScanner!.MaybeActorOf(address).AndThen(proxy => proxy); - - - /// - /// Answers the TestActor<T>, being the protocol, of the new created Actor that implements the protocol. - /// The TestActor<T> is specifically used for test scenarios and provides runtime access to the internal - /// Actor instance. Test-based Actor instances are backed by the synchronous TestMailbox. - /// - /// The protocol type. - /// the Definition used to initialize the newly created Actor. - /// - public TestActor? TestActorFor(Definition definition) - { - var redefinition = Definition.Has( - definition.Type, - definition.Parameters(), - TestMailbox.Name, - definition.ActorName); - - try - { - return ActorProtocolFor( - redefinition, - definition.ParentOr(World.DefaultParent), - null, - null, - definition.Supervisor, - definition.LoggerOr(World.DefaultLogger))!.ToTestActor(); - - } - catch (Exception e) - { - World.DefaultLogger.Error($"vlingo-net/actors: FAILED: {e.Message}", e); - Console.WriteLine(e.Message); - Console.WriteLine(e.StackTrace); - } - - return null; - } - - public TestActor? TestActorFor(Expression> factory) - => TestActorFor(Definition.Has(factory)); - - public TestActor? TestActorFor(Type actorType, params object[] parameters) - => TestActorFor(Definition.Has(actorType, parameters.ToList())); - - /// - /// Answers a Protocols that provides one or more supported for the - /// newly created Actor according to , that can be used for testing. - /// Test-based Actor instances are backed by the synchronous TestMailbox. - /// - /// The array of protocols that the Actor supports. - /// The Definition providing parameters to the Actor. - /// - internal Protocols TestActorFor(Type[] protocols, Definition definition) - { - var redefinition = Definition.Has( - definition.Type, - definition.Parameters(), - TestMailbox.Name, - definition.ActorName); - - var all = ActorProtocolFor( - protocols, - redefinition, - definition.ParentOr(World.DefaultParent), - null, - null, - definition.Supervisor, - definition.LoggerOr(World.DefaultLogger)); - - return new Protocols(ActorProtocolActor.ToTestActors(all, protocols)); - } - - /// - /// Gets the count of the number of Actor instances contained in this Stage. - /// - public int Count => _directory.Count; - - /// - /// A debugging tool used to print information about the Actor instances contained in this Stage. - /// - public void Dump() - { - var logger = World.DefaultLogger; - if (logger.IsEnabled) - { - logger.Debug($"STAGE: {Name}"); - _directory.Dump(logger); - } - } - - /// - /// Gets the name of this Stage. - /// - public string Name { get; } - - /// - /// Registers with this Stage the supervisor for the given . - /// - /// - /// - public void RegisterCommonSupervisor(Type? protocol, ISupervisor common) - { - if (protocol != null) _commonSupervisors[protocol] = common; - } - - /// - /// Gets the Scheduler of this Stage. - /// - public Scheduler Scheduler => _scheduler; - - /// - /// Gets whether or not this Stage has been stopped or is in the process of stopping. - /// - public bool IsStopped => _stopped.Get(); - - public void Conclude() => Stop(); - - /// - /// Initiates the process of stopping this Stage. - /// - public void Stop() - { - if (!_stopped.CompareAndSet(false, true)) - { - return; - } - - Sweep(); - - var retries = 0; - while (Count > 1 && ++retries < 10) - { - try - { - Thread.Sleep(10); - } - catch (Exception) - { - // nothing to do - } - } - - _scheduler.Close(); - } - - /// - /// Gets the World instance of this Stage. - /// - public World World { get; } - - /// - /// Answers the protocol for the newly created Actor instance. (INTERNAL ONLY) - /// - /// The protocol of the Actor. - /// The definition of the Actor. - /// The Actor parent of this Actor. - /// The possible supervisor of this Actor. - /// The logger for this Actor. - /// - internal T ActorFor(Definition definition, Actor? parent, ISupervisor? maybeSupervisor, ILogger logger) - { - var actor = ActorProtocolFor(definition, parent, null, null, maybeSupervisor, logger); - return actor!.ProtocolActor; - } - - internal T ActorFor(Expression> factory, Actor? parent, ISupervisor? maybeSupervisor, ILogger logger) - => ActorFor(Definition.Has(factory), parent, maybeSupervisor, logger); - - /// - /// Answers the ActorProtocolActor for the newly created Actor instance. (INTERNAL ONLY) - /// - /// - /// - /// - /// - /// - /// - /// - /// - internal ActorProtocolActor? ActorProtocolFor( - Definition definition, - Actor? parent, - IAddress? maybeAddress, - IMailbox? maybeMailbox, - ISupervisor? maybeSupervisor, - ILogger logger) - { - AssertProtocolCompliance(typeof(T)); - try - { - var actor = CreateRawActor(definition, parent, maybeAddress, maybeMailbox, maybeSupervisor, logger); - var protocolActor = ActorProxyFor(actor, actor.LifeCycle.Environment.Mailbox); - return new ActorProtocolActor(actor, protocolActor); - } - catch (ActorAddressAlreadyRegisteredException) - { - throw; - } - catch (Exception e) - { - World.DefaultLogger.Error($"vlingo-net/actors: FAILED: {e.Message}", e); - } - - return null; - } - - /// - /// Answers the protocol proxy for this newly created Actor. (INTERNAL ONLY) - /// - /// The protocol of the Actor - /// The Actor instance that backs the proxy protocol - /// The Mailbox instance of this Actor - /// - internal T ActorProxyFor(Actor actor, IMailbox mailbox) - => ActorProxy.CreateFor(actor, mailbox); - - /// - /// Answers the common Supervisor for the given protocol or the defaultSupervisor if there is - /// no registered common Supervisor. (INTERNAL ONLY) - /// - /// The protocol of the supervisor. - /// The default Supervisor to be used if there is no registered common Supervisor. - /// - internal ISupervisor CommonSupervisorOr(ISupervisor defaultSupervisor) - { - if (_commonSupervisors.TryGetValue(typeof(T), out ISupervisor? value)) - { - return value; - } - - return defaultSupervisor; - } - - /// - /// Answers my Directory instance. (INTERNAL ONLY) - /// - internal Directory Directory => _directory; - - /// - /// Handles a failure by suspending the Actor and dispatching to the Supervisor. (INTERNAL ONLY) - /// - /// The Supervised instance, which is an Actor - internal void HandleFailureOf(ISupervised supervised) - { - supervised.Suspend(); - supervised.Supervisor.Inform(supervised.Error, supervised); - } - - /// - /// Start the directory scan process in search for a given Actor instance. (INTERNAL ONLY) - /// - internal void StartDirectoryScanner() - { - _directoryScanner = ActorFor( - Definition.Has( - Definition.Parameters(_directory)), - World.AddressFactory.UniqueWith($"DirectoryScanner::{Name}")); - - var evictionConfiguration = World.Configuration.DirectoryEvictionConfiguration; - - if (evictionConfiguration != null && evictionConfiguration.IsEnabled) - { - World.DefaultLogger.Debug($"Scheduling directory eviction for stage: {Name} with: {evictionConfiguration}"); - var evictorActor = ActorFor>( - Definition.Has(() => new DirectoryEvictor(evictionConfiguration, Directory)), - World.AddressFactory.UniqueWith($"EvictorActor::{Name}")); - - var evictorActorInterval = Properties.GetLong( - "stage.evictor.interval", Math.Min(15_000L, evictionConfiguration.LruThresholdMillis)); - - Scheduler.Schedule(evictorActor, null!, TimeSpan.FromMilliseconds(evictorActorInterval), TimeSpan.FromMilliseconds(evictorActorInterval)); - } - } - - /// - /// Stop the given Actor and all its children. The Actor instance is first removed from - /// the Directory of this Stage. (INTERNAL ONLY) - /// - /// The Actor to stop. - internal void Stop(Actor actor) - { - var removedActor = _directory.Remove(actor.Address); - - if (Equals(actor, removedActor)) - { - removedActor.LifeCycle.Stop(actor); - } - } - - internal Actor RawLookupOrStart(Definition definition, IAddress address) - { - var actor = Directory.ActorOf(address); - if (actor != null) - { - return actor; - } - try - { - return CreateRawActor(definition, definition.ParentOr(World.DefaultParent), address, null, definition.Supervisor, World.DefaultLogger); - } - catch (ActorAddressAlreadyRegisteredException) - { - return RawLookupOrStart(definition, address); - } - } - - internal T LookupOrStart(Definition definition, IAddress address) - => ActorAs(ActorLookupOrStart(definition, address)); - - internal Actor ActorLookupOrStart(Definition definition, IAddress address) - { - var actor = Directory.ActorOf(address); - if (actor != null) - { - return actor; - } - - try - { - ActorFor(definition, address); - return Directory.ActorOf(address)!; - } - catch (ActorAddressAlreadyRegisteredException) - { - return ActorLookupOrStart(definition, address); - } - } - - internal T LookupOrStartThunk(Definition definition, IAddress? address) => ActorAs(ActorLookupOrStartThunk(definition, address)!); - - internal Actor? ActorLookupOrStartThunk(Definition definition, IAddress? address) - { - var actor = _directory.ActorOf(address); - if (actor != null) - { - return actor; - } - - try - { - ActorThunkFor(definition, address); - return _directory.ActorOf(address); - } - catch (ActorAddressAlreadyRegisteredException) - { - return ActorLookupOrStartThunk(definition, address); - } - } - - protected void ExtenderStartDirectoryScanner() => StartDirectoryScanner(); - - protected ActorFactory.IMailboxWrapper MailboxWrapper() => new ActorFactory.IdentityMailboxWrapper(); - - /// - /// Answers a Mailbox for an Actor. If maybeMailbox is allocated answer it; otherwise - /// answer a newly allocated Mailbox. (INTERNAL ONLY) - /// - /// the Definition of the newly created Actor - /// the Address allocated to the Actor - /// the possible Mailbox - /// - protected IMailbox AllocateMailbox(Definition definition, IAddress? address, IMailbox? maybeMailbox) - => maybeMailbox ?? ActorFactory.ActorMailbox(this, address, definition, MailboxWrapper()); - - /// - /// Answers the ActorProtocolActor[] for the newly created Actor instance. (INTERNAL ONLY) - /// - /// - /// - /// - /// - /// - /// - /// - /// - private ActorProtocolActor[]? ActorProtocolFor( - Type[] protocols, - Definition definition, - Actor? parent, - IAddress? maybeAddress, - IMailbox? maybeMailbox, - ISupervisor? maybeSupervisor, - ILogger logger) - { - AssertProtocolCompliance(protocols); - try - { - var actor = CreateRawActor(definition, parent, maybeAddress, maybeMailbox, maybeSupervisor, logger); - var protocolActors = ActorProxyFor(protocols, actor, actor.LifeCycle.Environment.Mailbox); - return ActorProtocolActor.AllOf(protocolActors, actor); - } - catch (Exception e) - { - World.DefaultLogger.Error($"vlingo-net/actors: FAILED: {e.Message}", e); - } - - return null; - } - - /// - /// Answers the proxy for this newly created Actor. (INTERNAL ONLY) - /// - /// The protocol of the Actor - /// The Actor instance that backs the proxy protocol - /// The Mailbox instance of this Actor - /// - private object ActorProxyFor(Type protocol, Actor actor, IMailbox mailbox) - => ActorProxy.CreateFor(protocol, actor, mailbox); - - /// - /// Answers the object[] protocol proxies for this newly created Actor. (INTERNAL ONLY) - /// - /// The protocols of the Actor - /// The Actor instance that backs the proxy protocol - /// The Mailbox instance of this Actor - /// - private object[] ActorProxyFor(Type[] protocols, Actor actor, IMailbox mailbox) - { - var proxies = new object[protocols.Length]; - - for (var idx = 0; idx < protocols.Length; ++idx) - { - proxies[idx] = ActorProxyFor(protocols[idx], actor, mailbox); - } - - return proxies; - } - - /// - /// Answers the ActorProtocolActor<object>[] for the newly created Actor instance. (INTERNAL ONLY) - /// - /// The protocols of the Actor. - /// The Definition of the Actor. - /// The Actor parent of this Actor. - /// The possible supervisor of this Actor. - /// Teh logger for this Actor. - /// - private ActorProtocolActor[]? ActorProtocolFor(Type[] protocols, Definition definition, Actor? parent, ISupervisor? maybeSupervisor, ILogger logger) - { - AssertProtocolCompliance(protocols); - return ActorProtocolFor(protocols, definition, parent, null, null, maybeSupervisor, logger); - } - - /// - /// Answers an Address for an Actor. If maybeAddress is allocated answer it; otherwise - /// answer a newly allocated Address. (INTERNAL ONLY) - /// - /// The Definition of the newly created Actor - /// The possible address - /// - private IAddress AllocateAddress(Definition definition, IAddress maybeAddress) - => maybeAddress ?? AddressFactory.UniqueWith(definition.ActorName); - - /// - /// Assert whether or not is an interface. - /// - /// Protocol that must be an interface. - private void AssertProtocolCompliance(Type protocol) - { - if (!protocol.IsInterface) - { - throw new ArgumentException($"Actor protocol must be an interface not a class: {protocol.Name}"); - } - } - - /// - /// Assert whether or not all of the are interfaces. - /// - /// Protocols that must all be interfaces. - private void AssertProtocolCompliance(ICollection protocols) - { - foreach(var protocol in protocols) - { - AssertProtocolCompliance(protocol); - } - } - - /// - /// Answers a newly created Actor instance from the internal ActorFactory. (INTERNAL ONLY) - /// - /// - /// - /// - /// - /// - /// - /// - /// - private Actor CreateRawActor( - Definition definition, - Actor? parent, - IAddress? maybeAddress, - IMailbox? maybeMailbox, - ISupervisor? maybeSupervisor, - ILogger logger) - { - if (IsStopped) - { - throw new InvalidOperationException("Actor stage has been stopped."); - } - - var address = maybeAddress ?? AddressFactory.UniqueWith(definition.ActorName); - if (_directory.IsRegistered(address)) - { - throw new ActorAddressAlreadyRegisteredException(definition.Type, address); - } - - var mailbox = maybeMailbox ?? ActorFactory.ActorMailbox(this, address, definition, MailboxWrapper()); - - Actor actor; - - try - { - actor = ActorFactory.ActorFor(this, parent, definition, address, mailbox, maybeSupervisor, logger); - } - catch (Exception e) - { - logger.Error($"Actor instantiation failed because: {e.Message}", e); - - throw new InvalidOperationException($"Actor instantiation failed because: {e.Message}", e); - } - - _directory.Register(actor.Address, actor); - actor.LifeCycle.BeforeStart(actor); - - return actor; - } - - /// - /// Stops all Actor instances from the PrivateRootActor down to the last child. (INTERNAL ONLY) - /// - private void Sweep() - { - if (World.PrivateRoot != null) - { - World.PrivateRoot.Stop(); - } - } - } - - /// - /// Internal type used to manage Actor proxy creation. (INTERNAL ONLY) - /// - /// The protocol type. - internal class ActorProtocolActor - { - private readonly Actor _actor; - - internal ActorProtocolActor(Actor actor, T protocol) - { - _actor = actor; - ProtocolActor = protocol; - } - - internal T ProtocolActor { get; } - - internal static ActorProtocolActor[] AllOf(T[] protocolActors, Actor actor) - { - var all = new ActorProtocolActor[protocolActors.Length]; - for (int idx = 0; idx < protocolActors.Length; ++idx) - { - all[idx] = new ActorProtocolActor(actor, protocolActors[idx]); - } - return all; - } - - internal static object[] ToActors(ActorProtocolActor[]? all) - { - if (all == null) - { - return new object[0]; - } - - var actors = new object[all.Length]; - for (int idx = 0; idx < all.Length; ++idx) - { - actors[idx] = all[idx].ProtocolActor; - } - return actors; - } - - internal static object[] ToTestActors(ActorProtocolActor[]? all, Type[] protocols) - { - if (all == null) - { - return new object[0]; - } - - var testActors = new object[all.Length]; - for (int idx = 0; idx < all.Length; ++idx) - { - testActors[idx] = all[idx].ToTestActor(protocols[idx]); - } - - return testActors; - } - - internal TestActor ToTestActor() => new TestActor(_actor, ProtocolActor, _actor.Address); - - private object ToTestActor(Type protocol) - { - var type = typeof(TestActor<>).MakeGenericType(protocol); - return Activator.CreateInstance(type, _actor, ProtocolActor, _actor.Address)!; - } - } +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Threading; +using Vlingo.Actors.Plugin.Mailbox.TestKit; +using Vlingo.Actors.TestKit; +using Vlingo.Xoom.Common; + +namespace Vlingo.Actors +{ + public class Stage : IStoppable + { + private readonly IDictionary _commonSupervisors; + private readonly Directory _directory; + private IDirectoryScanner? _directoryScanner; + private readonly Scheduler _scheduler; + private readonly AtomicBoolean _stopped; + + /// + /// Initializes the new Stage of the World and with . (INTERNAL ONLY) + /// + /// The World parent of this Stage. + /// AddressFactory for a this Stage. + /// The string name of this Stage. + /// + /// Uses default capacity of 32x32. + /// + internal Stage(World world, IAddressFactory addressFactory, string name) : this(world, addressFactory, name, 32, 32) + { + } + + /// + /// Initializes the new Stage of the World and with . (INTERNAL ONLY) + /// and capacity of and . + /// + /// The World parent of this Stage + /// The AddressFactory to be used + /// the name of this Stage + /// The number of buckets + /// The initial number of elements in each bucket + internal Stage(World world, IAddressFactory addressFactory, string name, int directoryBuckets, int directoryInitialCapacity) + { + AddressFactory = addressFactory; + World = world; + Name = name; + _directory = new Directory(world.AddressFactory.None(), directoryBuckets, directoryInitialCapacity); + _commonSupervisors = new Dictionary(); + _scheduler = new Scheduler(); + _stopped = new AtomicBoolean(false); + } + + /// + /// Answers the protocol type as the means to message the backing Actor. + /// + /// The protocol. + /// The Actor that implements the protocol + /// The as + public T ActorAs(Actor actor) + => ActorProxyFor(actor, actor.LifeCycle.Environment.Mailbox); + + /// + /// Answers the T protocol of the newly created Actor that implements the protocol. + /// + /// The protocol type + /// The type of Actor to create + /// Constructor parameters for the Actor + /// + public T ActorFor(Type type, params object[] parameters) + => ActorFor(Definition.Has(type, parameters.ToList())); + + /// + /// Answers the protocol of the newly created Actor that implements the protocol. + /// + /// The protocol type. + /// The Definition used to initialize the newly created Actor. + /// The Actor as . + public T ActorFor(Definition definition) + => ActorFor( + definition, + definition.ParentOr(World.DefaultParent), + definition.Supervisor, + definition.LoggerOr(World.DefaultLogger)); + + public T ActorFor(Expression> factory) + => ActorFor(Definition.Has(factory)); + + public T ActorFor(Expression> factory, string actorName) + => ActorFor(Definition.Has(factory, actorName)); + + /// + /// Answers the protocol of the newly created Actor that implements the protocol and + /// that will be assigned the specific and . + /// + /// The protocol + /// The Definition used to initialize the newly created Actor. + /// The IAddress to assign to the newly created Actor. + /// The ILogger to assign to the newly created Actor. + /// The Actor as . + public T ActorFor(Definition definition, IAddress address, ILogger logger) + { + var actorAddress = AllocateAddress(definition, address); + var actorMailbox = AllocateMailbox(definition, actorAddress, null); + + var actor = ActorProtocolFor( + definition, + definition.ParentOr(World.DefaultParent), + actorAddress, + actorMailbox, + definition.Supervisor, + logger); + + return actor!.ProtocolActor; + } + + public T ActorFor(Expression> factory, IAddress address, ILogger logger) + => ActorFor(Definition.Has(factory), address, logger); + + /// + /// Answers the protocol of the newly created Actor that implements the protocol and + /// that will be assigned the specific . + /// + /// The protocol. + /// The Definition used to initialize the newly created Actor. + /// The ILogger to assign to the newly created Actor. + /// The Actor as . + public T ActorFor(Definition definition, ILogger logger) + => ActorFor( + definition, + definition.ParentOr(World.DefaultParent), + definition.Supervisor, + logger); + + public T ActorFor(Expression> factory, ILogger logger) + => ActorFor(Definition.Has(factory), logger); + + /// + /// Answers the protocol of the newly created Actor that implements the protocol and + /// that will be assigned the specific . + /// + /// The protocol. + /// The Definition used to initialize the newly created Actor. + /// The IAddress to assign to the newly created Actor. + /// The Actor as . + public T ActorFor(Definition definition, IAddress address) + { + var actorAddress = AllocateAddress(definition, address); + var actorMailbox = AllocateMailbox(definition, actorAddress, null); + + var actor = ActorProtocolFor( + definition, + definition.ParentOr(World.DefaultParent), + actorAddress, + actorMailbox, + definition.Supervisor, + definition.LoggerOr(World.DefaultLogger)); + + return actor!.ProtocolActor; + } + + public T ActorThunkFor(Definition definition, IAddress? address) + { + var actorMailbox = AllocateMailbox(definition, address, null); + var actor = + ActorProtocolFor( + definition, + definition.ParentOr(World.DefaultParent), + address, + actorMailbox, + definition.Supervisor, + definition.LoggerOr(World.DefaultLogger)); + + return actor!.ProtocolActor; + } + + public T ActorFor(Expression> factory, IAddress address) + => ActorFor(Definition.Has(factory), address); + + public T ActorFor(Expression> factory, string mailboxName, string actorName) + => ActorFor(Definition.Has(factory, mailboxName, actorName)); + + public T ActorFor(Expression> factory, string mailboxName, string actorName, IAddress address, ILogger logger) + => ActorFor(Definition.Has(factory, mailboxName, actorName), address, logger); + + /// + /// Answers a Protocols that provides one or more supported for the + /// newly created Actor according to . + /// + /// Array of protocols that the Actor supports. + /// The definition providing parameters to the Actor. + /// The actor that is this actor's parent. + /// The possible supervisor of this actor. + /// The logger of this actor. + /// + public Protocols ActorFor(Type[] protocols, Definition definition, Actor parent, ISupervisor? maybeSupervisor, ILogger logger) + { + var all = ActorProtocolFor(protocols, definition, parent, maybeSupervisor, logger); + return new Protocols(ActorProtocolActor.ToActors(all)); + } + + /// + /// Answers a Protocols that provides one or more supported for the + /// newly created Actor according to . + /// + /// The array of protocol that the Actor supports. + /// The Definition providing parameters to the Actor. + /// A instance. + public Protocols ActorFor(Type[] protocols, Definition definition) + { + var all = ActorProtocolFor( + protocols, + definition, + definition.ParentOr(World.DefaultParent), + definition.Supervisor, + definition.LoggerOr(World.DefaultLogger)); + + return new Protocols(ActorProtocolActor.ToActors(all)); + } + + /// + /// Answers a Protocols that provides one or more supported for the + /// newly created Actor with the provided . + /// + /// The array of protocol that the Actor supports. + /// The type of the Actor to create. + /// The constructor parameters. + /// A instance. + public Protocols ActorFor(Type[] protocols, Type type, params object[] parameters) + => ActorFor(protocols, Definition.Has(type, parameters.ToList())); + + /// + /// Answers the ICompletes<T> that will eventually complete with the protocol + /// of the backing Actor of the given , or null if not found. + /// + /// The protocol supported by the backing Actor. + /// The IAddress of the Actor to find. + /// ICompletes<T> of the backing actor found by the address. null if not found. + public ICompletes ActorOf(IAddress address) => _directoryScanner!.ActorOf(address).AndThen(proxy => proxy); + + public IAddressFactory AddressFactory { get; } + + /// + /// Answer the protocol reference of the actor with as a non-empty + /// ICompletes<Optional<T>> eventual outcome, or an empty ICompletes<Optional<T>> + /// if not found. + /// + /// The protocol that the actor must support. + /// The address of the actor to find. + /// + public ICompletes> MaybeActorOf(IAddress address) + => _directoryScanner!.MaybeActorOf(address).AndThen(proxy => proxy); + + + /// + /// Answers the TestActor<T>, being the protocol, of the new created Actor that implements the protocol. + /// The TestActor<T> is specifically used for test scenarios and provides runtime access to the internal + /// Actor instance. Test-based Actor instances are backed by the synchronous TestMailbox. + /// + /// The protocol type. + /// the Definition used to initialize the newly created Actor. + /// + public TestActor? TestActorFor(Definition definition) + { + var redefinition = Definition.Has( + definition.Type, + definition.Parameters(), + TestMailbox.Name, + definition.ActorName); + + try + { + return ActorProtocolFor( + redefinition, + definition.ParentOr(World.DefaultParent), + null, + null, + definition.Supervisor, + definition.LoggerOr(World.DefaultLogger))!.ToTestActor(); + + } + catch (Exception e) + { + World.DefaultLogger.Error($"vlingo-net/actors: FAILED: {e.Message}", e); + Console.WriteLine(e.Message); + Console.WriteLine(e.StackTrace); + } + + return null; + } + + public TestActor? TestActorFor(Expression> factory) + => TestActorFor(Definition.Has(factory)); + + public TestActor? TestActorFor(Type actorType, params object[] parameters) + => TestActorFor(Definition.Has(actorType, parameters.ToList())); + + /// + /// Answers a Protocols that provides one or more supported for the + /// newly created Actor according to , that can be used for testing. + /// Test-based Actor instances are backed by the synchronous TestMailbox. + /// + /// The array of protocols that the Actor supports. + /// The Definition providing parameters to the Actor. + /// + internal Protocols TestActorFor(Type[] protocols, Definition definition) + { + var redefinition = Definition.Has( + definition.Type, + definition.Parameters(), + TestMailbox.Name, + definition.ActorName); + + var all = ActorProtocolFor( + protocols, + redefinition, + definition.ParentOr(World.DefaultParent), + null, + null, + definition.Supervisor, + definition.LoggerOr(World.DefaultLogger)); + + return new Protocols(ActorProtocolActor.ToTestActors(all, protocols)); + } + + /// + /// Gets the count of the number of Actor instances contained in this Stage. + /// + public int Count => _directory.Count; + + /// + /// A debugging tool used to print information about the Actor instances contained in this Stage. + /// + public void Dump() + { + var logger = World.DefaultLogger; + if (logger.IsEnabled) + { + logger.Debug($"STAGE: {Name}"); + _directory.Dump(logger); + } + } + + /// + /// Gets the name of this Stage. + /// + public string Name { get; } + + /// + /// Registers with this Stage the supervisor for the given . + /// + /// + /// + public void RegisterCommonSupervisor(Type? protocol, ISupervisor common) + { + if (protocol != null) _commonSupervisors[protocol] = common; + } + + /// + /// Gets the Scheduler of this Stage. + /// + public Scheduler Scheduler => _scheduler; + + /// + /// Gets whether or not this Stage has been stopped or is in the process of stopping. + /// + public bool IsStopped => _stopped.Get(); + + public void Conclude() => Stop(); + + /// + /// Initiates the process of stopping this Stage. + /// + public void Stop() + { + if (!_stopped.CompareAndSet(false, true)) + { + return; + } + + Sweep(); + + var retries = 0; + while (Count > 1 && ++retries < 10) + { + try + { + Thread.Sleep(10); + } + catch (Exception) + { + // nothing to do + } + } + + _scheduler.Close(); + } + + /// + /// Gets the World instance of this Stage. + /// + public World World { get; } + + /// + /// Answers the protocol for the newly created Actor instance. (INTERNAL ONLY) + /// + /// The protocol of the Actor. + /// The definition of the Actor. + /// The Actor parent of this Actor. + /// The possible supervisor of this Actor. + /// The logger for this Actor. + /// + internal T ActorFor(Definition definition, Actor? parent, ISupervisor? maybeSupervisor, ILogger logger) + { + var actor = ActorProtocolFor(definition, parent, null, null, maybeSupervisor, logger); + return actor!.ProtocolActor; + } + + internal T ActorFor(Expression> factory, Actor? parent, ISupervisor? maybeSupervisor, ILogger logger) + => ActorFor(Definition.Has(factory), parent, maybeSupervisor, logger); + + /// + /// Answers the ActorProtocolActor for the newly created Actor instance. (INTERNAL ONLY) + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal ActorProtocolActor? ActorProtocolFor( + Definition definition, + Actor? parent, + IAddress? maybeAddress, + IMailbox? maybeMailbox, + ISupervisor? maybeSupervisor, + ILogger logger) + { + AssertProtocolCompliance(typeof(T)); + try + { + var actor = CreateRawActor(definition, parent, maybeAddress, maybeMailbox, maybeSupervisor, logger); + var protocolActor = ActorProxyFor(actor, actor.LifeCycle.Environment.Mailbox); + return new ActorProtocolActor(actor, protocolActor); + } + catch (ActorAddressAlreadyRegisteredException) + { + throw; + } + catch (Exception e) + { + World.DefaultLogger.Error($"vlingo-net/actors: FAILED: {e.Message}", e); + } + + return null; + } + + /// + /// Answers the protocol proxy for this newly created Actor. (INTERNAL ONLY) + /// + /// The protocol of the Actor + /// The Actor instance that backs the proxy protocol + /// The Mailbox instance of this Actor + /// + internal T ActorProxyFor(Actor actor, IMailbox mailbox) + => ActorProxy.CreateFor(actor, mailbox); + + /// + /// Answers the common Supervisor for the given protocol or the defaultSupervisor if there is + /// no registered common Supervisor. (INTERNAL ONLY) + /// + /// The protocol of the supervisor. + /// The default Supervisor to be used if there is no registered common Supervisor. + /// + internal ISupervisor CommonSupervisorOr(ISupervisor defaultSupervisor) + { + if (_commonSupervisors.TryGetValue(typeof(T), out ISupervisor? value)) + { + return value; + } + + return defaultSupervisor; + } + + /// + /// Answers my Directory instance. (INTERNAL ONLY) + /// + internal Directory Directory => _directory; + + /// + /// Handles a failure by suspending the Actor and dispatching to the Supervisor. (INTERNAL ONLY) + /// + /// The Supervised instance, which is an Actor + internal void HandleFailureOf(ISupervised supervised) + { + supervised.Suspend(); + supervised.Supervisor.Inform(supervised.Error, supervised); + } + + /// + /// Start the directory scan process in search for a given Actor instance. (INTERNAL ONLY) + /// + internal void StartDirectoryScanner() + { + _directoryScanner = ActorFor( + Definition.Has( + Definition.Parameters(_directory)), + World.AddressFactory.UniqueWith($"DirectoryScanner::{Name}")); + + var evictionConfiguration = World.Configuration.DirectoryEvictionConfiguration; + + if (evictionConfiguration != null && evictionConfiguration.IsEnabled) + { + World.DefaultLogger.Debug($"Scheduling directory eviction for stage: {Name} with: {evictionConfiguration}"); + var evictorActor = ActorFor>( + Definition.Has(() => new DirectoryEvictor(evictionConfiguration, Directory)), + World.AddressFactory.UniqueWith($"EvictorActor::{Name}")); + + var evictorActorInterval = Properties.GetLong( + "stage.evictor.interval", Math.Min(15_000L, evictionConfiguration.LruThresholdMillis)); + + Scheduler.Schedule(evictorActor, null!, TimeSpan.FromMilliseconds(evictorActorInterval), TimeSpan.FromMilliseconds(evictorActorInterval)); + } + } + + /// + /// Stop the given Actor and all its children. The Actor instance is first removed from + /// the Directory of this Stage. (INTERNAL ONLY) + /// + /// The Actor to stop. + internal void Stop(Actor actor) + { + var removedActor = _directory.Remove(actor.Address); + + if (Equals(actor, removedActor)) + { + removedActor.LifeCycle.Stop(actor); + } + } + + internal Actor RawLookupOrStart(Definition definition, IAddress address) + { + var actor = Directory.ActorOf(address); + if (actor != null) + { + return actor; + } + try + { + return CreateRawActor(definition, definition.ParentOr(World.DefaultParent), address, null, definition.Supervisor, World.DefaultLogger); + } + catch (ActorAddressAlreadyRegisteredException) + { + return RawLookupOrStart(definition, address); + } + } + + internal T LookupOrStart(Definition definition, IAddress address) + => ActorAs(ActorLookupOrStart(definition, address)); + + internal Actor ActorLookupOrStart(Definition definition, IAddress address) + { + var actor = Directory.ActorOf(address); + if (actor != null) + { + return actor; + } + + try + { + ActorFor(definition, address); + return Directory.ActorOf(address)!; + } + catch (ActorAddressAlreadyRegisteredException) + { + return ActorLookupOrStart(definition, address); + } + } + + internal T LookupOrStartThunk(Definition definition, IAddress? address) => ActorAs(ActorLookupOrStartThunk(definition, address)!); + + internal Actor? ActorLookupOrStartThunk(Definition definition, IAddress? address) + { + var actor = _directory.ActorOf(address); + if (actor != null) + { + return actor; + } + + try + { + ActorThunkFor(definition, address); + return _directory.ActorOf(address); + } + catch (ActorAddressAlreadyRegisteredException) + { + return ActorLookupOrStartThunk(definition, address); + } + } + + protected void ExtenderStartDirectoryScanner() => StartDirectoryScanner(); + + protected ActorFactory.IMailboxWrapper MailboxWrapper() => new ActorFactory.IdentityMailboxWrapper(); + + /// + /// Answers a Mailbox for an Actor. If maybeMailbox is allocated answer it; otherwise + /// answer a newly allocated Mailbox. (INTERNAL ONLY) + /// + /// the Definition of the newly created Actor + /// the Address allocated to the Actor + /// the possible Mailbox + /// + protected IMailbox AllocateMailbox(Definition definition, IAddress? address, IMailbox? maybeMailbox) + => maybeMailbox ?? ActorFactory.ActorMailbox(this, address, definition, MailboxWrapper()); + + /// + /// Answers the ActorProtocolActor[] for the newly created Actor instance. (INTERNAL ONLY) + /// + /// + /// + /// + /// + /// + /// + /// + /// + private ActorProtocolActor[]? ActorProtocolFor( + Type[] protocols, + Definition definition, + Actor? parent, + IAddress? maybeAddress, + IMailbox? maybeMailbox, + ISupervisor? maybeSupervisor, + ILogger logger) + { + AssertProtocolCompliance(protocols); + try + { + var actor = CreateRawActor(definition, parent, maybeAddress, maybeMailbox, maybeSupervisor, logger); + var protocolActors = ActorProxyFor(protocols, actor, actor.LifeCycle.Environment.Mailbox); + return ActorProtocolActor.AllOf(protocolActors, actor); + } + catch (Exception e) + { + World.DefaultLogger.Error($"vlingo-net/actors: FAILED: {e.Message}", e); + } + + return null; + } + + /// + /// Answers the proxy for this newly created Actor. (INTERNAL ONLY) + /// + /// The protocol of the Actor + /// The Actor instance that backs the proxy protocol + /// The Mailbox instance of this Actor + /// + private object ActorProxyFor(Type protocol, Actor actor, IMailbox mailbox) + => ActorProxy.CreateFor(protocol, actor, mailbox); + + /// + /// Answers the object[] protocol proxies for this newly created Actor. (INTERNAL ONLY) + /// + /// The protocols of the Actor + /// The Actor instance that backs the proxy protocol + /// The Mailbox instance of this Actor + /// + private object[] ActorProxyFor(Type[] protocols, Actor actor, IMailbox mailbox) + { + var proxies = new object[protocols.Length]; + + for (var idx = 0; idx < protocols.Length; ++idx) + { + proxies[idx] = ActorProxyFor(protocols[idx], actor, mailbox); + } + + return proxies; + } + + /// + /// Answers the ActorProtocolActor<object>[] for the newly created Actor instance. (INTERNAL ONLY) + /// + /// The protocols of the Actor. + /// The Definition of the Actor. + /// The Actor parent of this Actor. + /// The possible supervisor of this Actor. + /// Teh logger for this Actor. + /// + private ActorProtocolActor[]? ActorProtocolFor(Type[] protocols, Definition definition, Actor? parent, ISupervisor? maybeSupervisor, ILogger logger) + { + AssertProtocolCompliance(protocols); + return ActorProtocolFor(protocols, definition, parent, null, null, maybeSupervisor, logger); + } + + /// + /// Answers an Address for an Actor. If maybeAddress is allocated answer it; otherwise + /// answer a newly allocated Address. (INTERNAL ONLY) + /// + /// The Definition of the newly created Actor + /// The possible address + /// + private IAddress AllocateAddress(Definition definition, IAddress maybeAddress) + => maybeAddress ?? AddressFactory.UniqueWith(definition.ActorName); + + /// + /// Assert whether or not is an interface. + /// + /// Protocol that must be an interface. + private void AssertProtocolCompliance(Type protocol) + { + if (!protocol.IsInterface) + { + throw new ArgumentException($"Actor protocol must be an interface not a class: {protocol.Name}"); + } + } + + /// + /// Assert whether or not all of the are interfaces. + /// + /// Protocols that must all be interfaces. + private void AssertProtocolCompliance(ICollection protocols) + { + foreach(var protocol in protocols) + { + AssertProtocolCompliance(protocol); + } + } + + /// + /// Answers a newly created Actor instance from the internal ActorFactory. (INTERNAL ONLY) + /// + /// + /// + /// + /// + /// + /// + /// + /// + private Actor CreateRawActor( + Definition definition, + Actor? parent, + IAddress? maybeAddress, + IMailbox? maybeMailbox, + ISupervisor? maybeSupervisor, + ILogger logger) + { + if (IsStopped) + { + throw new InvalidOperationException("Actor stage has been stopped."); + } + + var address = maybeAddress ?? AddressFactory.UniqueWith(definition.ActorName); + if (_directory.IsRegistered(address)) + { + throw new ActorAddressAlreadyRegisteredException(definition.Type, address); + } + + var mailbox = maybeMailbox ?? ActorFactory.ActorMailbox(this, address, definition, MailboxWrapper()); + + Actor actor; + + try + { + actor = ActorFactory.ActorFor(this, parent, definition, address, mailbox, maybeSupervisor, logger); + } + catch (Exception e) + { + logger.Error($"Actor instantiation failed because: {e.Message}", e); + + throw new InvalidOperationException($"Actor instantiation failed because: {e.Message}", e); + } + + _directory.Register(actor.Address, actor); + actor.LifeCycle.BeforeStart(actor); + + return actor; + } + + /// + /// Stops all Actor instances from the PrivateRootActor down to the last child. (INTERNAL ONLY) + /// + private void Sweep() + { + if (World.PrivateRoot != null) + { + World.PrivateRoot.Stop(); + } + } + } + + /// + /// Internal type used to manage Actor proxy creation. (INTERNAL ONLY) + /// + /// The protocol type. + internal class ActorProtocolActor + { + private readonly Actor _actor; + + internal ActorProtocolActor(Actor actor, T protocol) + { + _actor = actor; + ProtocolActor = protocol; + } + + internal T ProtocolActor { get; } + + internal static ActorProtocolActor[] AllOf(T[] protocolActors, Actor actor) + { + var all = new ActorProtocolActor[protocolActors.Length]; + for (int idx = 0; idx < protocolActors.Length; ++idx) + { + all[idx] = new ActorProtocolActor(actor, protocolActors[idx]); + } + return all; + } + + internal static object[] ToActors(ActorProtocolActor[]? all) + { + if (all == null) + { + return new object[0]; + } + + var actors = new object[all.Length]; + for (int idx = 0; idx < all.Length; ++idx) + { + actors[idx] = all[idx].ProtocolActor; + } + return actors; + } + + internal static object[] ToTestActors(ActorProtocolActor[]? all, Type[] protocols) + { + if (all == null) + { + return new object[0]; + } + + var testActors = new object[all.Length]; + for (int idx = 0; idx < all.Length; ++idx) + { + testActors[idx] = all[idx].ToTestActor(protocols[idx]); + } + + return testActors; + } + + internal TestActor ToTestActor() => new TestActor(_actor, ProtocolActor, _actor.Address); + + private object ToTestActor(Type protocol) + { + var type = typeof(TestActor<>).MakeGenericType(protocol); + return Activator.CreateInstance(type, _actor, ProtocolActor, _actor.Address)!; + } + } } \ No newline at end of file diff --git a/src/Vlingo.Actors/StageSupervisedActor.cs b/src/Vlingo.Xoom.Actors/StageSupervisedActor.cs similarity index 100% rename from src/Vlingo.Actors/StageSupervisedActor.cs rename to src/Vlingo.Xoom.Actors/StageSupervisedActor.cs diff --git a/src/Vlingo.Actors/Startable__Proxy.cs b/src/Vlingo.Xoom.Actors/Startable__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/Startable__Proxy.cs rename to src/Vlingo.Xoom.Actors/Startable__Proxy.cs diff --git a/src/Vlingo.Actors/Stoppable__Proxy.cs b/src/Vlingo.Xoom.Actors/Stoppable__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/Stoppable__Proxy.cs rename to src/Vlingo.Xoom.Actors/Stoppable__Proxy.cs diff --git a/src/Vlingo.Actors/Stowage.cs b/src/Vlingo.Xoom.Actors/Stowage.cs similarity index 96% rename from src/Vlingo.Actors/Stowage.cs rename to src/Vlingo.Xoom.Actors/Stowage.cs index 9eab9a43..2597bbdf 100644 --- a/src/Vlingo.Actors/Stowage.cs +++ b/src/Vlingo.Xoom.Actors/Stowage.cs @@ -1,122 +1,122 @@ -// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. -// -// This Source Code Form is subject to the terms of the -// Mozilla Public License, v. 2.0. If a copy of the MPL -// was not distributed with this file, You can obtain -// one at https://mozilla.org/MPL/2.0/. - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Vlingo.Actors -{ - internal class Stowage - { - private Queue? stowedMessages; - private volatile bool dispersing; - private volatile bool stowing; - - public Stowage() - { - dispersing = false; - stowing = false; - Reset(); - } - - public override string ToString() - => $"Stowage[stowing={stowing}, dispersing={dispersing}, messages={stowedMessages}]"; - - internal int Count => stowedMessages!.Count; - - internal void Dump(ILogger logger) - { - foreach (var message in stowedMessages!) - { - logger.Debug($"STOWED: {message}"); - } - } - - internal bool HasMessages => stowedMessages!.Count > 0; - - internal IMessage? Head - { - get - { - if (!HasMessages) - { - Reset(); - return null; - } - - return stowedMessages!.Dequeue(); - } - } - - internal void Reset() - { - stowedMessages = new Queue(); - stowing = false; - dispersing = false; - } - - internal bool IsStowing => stowing; - - internal void StowingMode() - { - stowing = true; - dispersing = false; - } - - internal bool IsDispersing => dispersing; - - internal void DispersingMode() - { - stowing = false; - dispersing = true; - } - - internal void Restow(Stowage other) - { - var message = Head; - while (message != null) - { - other.Stow(message); - message = Head; - } - } - - internal void Stow(IMessage message) - { - if (IsStowing) - { - IMessage toStow; - if (message.IsStowed) - { - toStow = message; - } - else - { - var closedMsgType = message.GetType().GetGenericArguments().First(); - var stowedLocalMsgType = typeof(StowedLocalMessage<>).MakeGenericType(closedMsgType); - toStow = (IMessage)Activator.CreateInstance(stowedLocalMsgType, message)!; - } - - stowedMessages!.Enqueue(toStow); - } - } - - internal IMessage SwapWith(IMessage newerMessage) - { - if (!HasMessages) - { - Reset(); - return newerMessage; - } - - var olderMessage = stowedMessages!.Dequeue(); - stowedMessages.Enqueue(new StowedLocalMessage((LocalMessage)newerMessage)); - return olderMessage; - } - } +// Copyright (c) 2012-2021 VLINGO LABS. All rights reserved. +// +// This Source Code Form is subject to the terms of the +// Mozilla Public License, v. 2.0. If a copy of the MPL +// was not distributed with this file, You can obtain +// one at https://mozilla.org/MPL/2.0/. + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Vlingo.Actors +{ + internal class Stowage + { + private Queue? stowedMessages; + private volatile bool dispersing; + private volatile bool stowing; + + public Stowage() + { + dispersing = false; + stowing = false; + Reset(); + } + + public override string ToString() + => $"Stowage[stowing={stowing}, dispersing={dispersing}, messages={stowedMessages}]"; + + internal int Count => stowedMessages!.Count; + + internal void Dump(ILogger logger) + { + foreach (var message in stowedMessages!) + { + logger.Debug($"STOWED: {message}"); + } + } + + internal bool HasMessages => stowedMessages!.Count > 0; + + internal IMessage? Head + { + get + { + if (!HasMessages) + { + Reset(); + return null; + } + + return stowedMessages!.Dequeue(); + } + } + + internal void Reset() + { + stowedMessages = new Queue(); + stowing = false; + dispersing = false; + } + + internal bool IsStowing => stowing; + + internal void StowingMode() + { + stowing = true; + dispersing = false; + } + + internal bool IsDispersing => dispersing; + + internal void DispersingMode() + { + stowing = false; + dispersing = true; + } + + internal void Restow(Stowage other) + { + var message = Head; + while (message != null) + { + other.Stow(message); + message = Head; + } + } + + internal void Stow(IMessage message) + { + if (IsStowing) + { + IMessage toStow; + if (message.IsStowed) + { + toStow = message; + } + else + { + var closedMsgType = message.GetType().GetGenericArguments().First(); + var stowedLocalMsgType = typeof(StowedLocalMessage<>).MakeGenericType(closedMsgType); + toStow = (IMessage)Activator.CreateInstance(stowedLocalMsgType, message)!; + } + + stowedMessages!.Enqueue(toStow); + } + } + + internal IMessage SwapWith(IMessage newerMessage) + { + if (!HasMessages) + { + Reset(); + return newerMessage; + } + + var olderMessage = stowedMessages!.Dequeue(); + stowedMessages.Enqueue(new StowedLocalMessage((LocalMessage)newerMessage)); + return olderMessage; + } + } } \ No newline at end of file diff --git a/src/Vlingo.Actors/StowedLocalMessage.cs b/src/Vlingo.Xoom.Actors/StowedLocalMessage.cs similarity index 100% rename from src/Vlingo.Actors/StowedLocalMessage.cs rename to src/Vlingo.Xoom.Actors/StowedLocalMessage.cs diff --git a/src/Vlingo.Actors/SupervisionStrategyConstants.cs b/src/Vlingo.Xoom.Actors/SupervisionStrategyConstants.cs similarity index 100% rename from src/Vlingo.Actors/SupervisionStrategyConstants.cs rename to src/Vlingo.Xoom.Actors/SupervisionStrategyConstants.cs diff --git a/src/Vlingo.Actors/Supervisor__Proxy.cs b/src/Vlingo.Xoom.Actors/Supervisor__Proxy.cs similarity index 100% rename from src/Vlingo.Actors/Supervisor__Proxy.cs rename to src/Vlingo.Xoom.Actors/Supervisor__Proxy.cs diff --git a/src/Vlingo.Actors/TaskExtensions.cs b/src/Vlingo.Xoom.Actors/TaskExtensions.cs similarity index 100% rename from src/Vlingo.Actors/TaskExtensions.cs rename to src/Vlingo.Xoom.Actors/TaskExtensions.cs diff --git a/src/Vlingo.Actors/TestKit/AccessSafely.cs b/src/Vlingo.Xoom.Actors/TestKit/AccessSafely.cs similarity index 100% rename from src/Vlingo.Actors/TestKit/AccessSafely.cs rename to src/Vlingo.Xoom.Actors/TestKit/AccessSafely.cs diff --git a/src/Vlingo.Actors/TestKit/ITestStateView.cs b/src/Vlingo.Xoom.Actors/TestKit/ITestStateView.cs similarity index 100% rename from src/Vlingo.Actors/TestKit/ITestStateView.cs rename to src/Vlingo.Xoom.Actors/TestKit/ITestStateView.cs diff --git a/src/Vlingo.Actors/TestKit/TestActor.cs b/src/Vlingo.Xoom.Actors/TestKit/TestActor.cs similarity index 100% rename from src/Vlingo.Actors/TestKit/TestActor.cs rename to src/Vlingo.Xoom.Actors/TestKit/TestActor.cs diff --git a/src/Vlingo.Actors/TestKit/TestContext.cs b/src/Vlingo.Xoom.Actors/TestKit/TestContext.cs similarity index 100% rename from src/Vlingo.Actors/TestKit/TestContext.cs rename to src/Vlingo.Xoom.Actors/TestKit/TestContext.cs diff --git a/src/Vlingo.Actors/TestKit/TestEnvironment.cs b/src/Vlingo.Xoom.Actors/TestKit/TestEnvironment.cs similarity index 100% rename from src/Vlingo.Actors/TestKit/TestEnvironment.cs rename to src/Vlingo.Xoom.Actors/TestKit/TestEnvironment.cs diff --git a/src/Vlingo.Actors/TestKit/TestState.cs b/src/Vlingo.Xoom.Actors/TestKit/TestState.cs similarity index 100% rename from src/Vlingo.Actors/TestKit/TestState.cs rename to src/Vlingo.Xoom.Actors/TestKit/TestState.cs diff --git a/src/Vlingo.Actors/TestKit/TestUntil.cs b/src/Vlingo.Xoom.Actors/TestKit/TestUntil.cs similarity index 100% rename from src/Vlingo.Actors/TestKit/TestUntil.cs rename to src/Vlingo.Xoom.Actors/TestKit/TestUntil.cs diff --git a/src/Vlingo.Actors/TestKit/TestWorld.cs b/src/Vlingo.Xoom.Actors/TestKit/TestWorld.cs similarity index 100% rename from src/Vlingo.Actors/TestKit/TestWorld.cs rename to src/Vlingo.Xoom.Actors/TestKit/TestWorld.cs diff --git a/src/Vlingo.Actors/Vlingo.Actors.csproj b/src/Vlingo.Xoom.Actors/Vlingo.Xoom.Actors.csproj similarity index 86% rename from src/Vlingo.Actors/Vlingo.Actors.csproj rename to src/Vlingo.Xoom.Actors/Vlingo.Xoom.Actors.csproj index 1818e089..6ca53e58 100644 --- a/src/Vlingo.Actors/Vlingo.Actors.csproj +++ b/src/Vlingo.Xoom.Actors/Vlingo.Xoom.Actors.csproj @@ -7,16 +7,16 @@ true $(VlingoVersion) - Vlingo.Actors + Vlingo.Xoom.Actors Vlingo Type safe Actor Model toolkit for reactive concurrency and resiliency using C# and other .NET languages. false LICENSE - https://github.com/vlingo-net/vlingo-net-actors + https://github.com/vlingo-net/xoom-net-actors vlingo-64x64.png - https://github.com/vlingo-net/vlingo-net-actors + https://github.com/vlingo-net/xoom-net-actors Debug;Release;Debug With Project References @@ -28,7 +28,6 @@ - diff --git a/src/Vlingo.Actors/World.cs b/src/Vlingo.Xoom.Actors/World.cs similarity index 99% rename from src/Vlingo.Actors/World.cs rename to src/Vlingo.Xoom.Actors/World.cs index 7d5cf5a7..069b406f 100644 --- a/src/Vlingo.Actors/World.cs +++ b/src/Vlingo.Xoom.Actors/World.cs @@ -102,7 +102,7 @@ private World(string name, Configuration configuration) /// the contents of the . /// /// The string name to assign to the new World instance. - /// The used for configuration + /// The used for configuration /// A World instance. public static World Start(string name, Configuration configuration) { @@ -116,7 +116,7 @@ public static World Start(string name, Configuration configuration) /// /// Answers a new World with the given and that is configured with - /// the contents of the default of sensible settings. + /// the contents of the default of sensible settings. /// /// The string name to assign to the new World instance. /// A World instance. diff --git a/src/Vlingo.Actors/vlingo-actors.json b/src/Vlingo.Xoom.Actors/vlingo-actors.json similarity index 100% rename from src/Vlingo.Actors/vlingo-actors.json rename to src/Vlingo.Xoom.Actors/vlingo-actors.json diff --git a/vlingo-64x64.png b/vlingo-64x64.png index 6527debe4bc0b798a5f14c54eceb530121b3a6db..509c2c047a3de6c810327e160b865378df483b71 100644 GIT binary patch literal 3107 zcmZ`*cTm&Y68_O6g7gxUA{P)YiG-#QQRyXw9(orLrFTSW(wm@&fFu~D1yH033PQMm zfx!q7q7q6#M2tcp^cX;WxqrSl^LFQ)Z}!{yX3rmcb~fMM)ZP% zdqBMGyZL(b0vou4jckknpuObykv|VRRtT_kv;lydDgcn41po(ZD*ZbE#KQn!)eivR zl>i_Wh3R!LU?+I5SX-C^fByBy{kZ#VhA+;_#*A-;TT)P2-CR%S8=K;YjIl*=kZKaE z0N}Wcm8lWx#_amT&?wXjc=QjWhpzj2%xB04w<63)O<9AgLe||*& zoy?X`vp^F%9QqGvp9jJ*lR(ZI$(KWc6DW^xm9R$`A-QW8 z+()Wc!>)F5&ghBBhQ;UCD3Uu9TmB64KAxq%z*xcBFe`q$yE|5D7dO!68rfr?k-D8n z%c%rWm3Htdm)p@8c9SyN8oRcZaGCEhcltBM03*v4sQ!Hy*+N}Ja9Z2GE^k}ZcO3)$ z1f!v@tw$)t>M=)qXW9$JVz}G|*T4Usif-Zl*nV?UfOfyJ5A=_!uAm7>w=>5^L-wZA zLBM7OCAN!i^DBiXD$I-fWaPrEno7A<0UbpiLv7X7?S6=Y)WHFSn!w43OcGtSOgyR4 zMa0101!0hcgoLhzqDTd zB@u|=i^N|?JFbV6igjPEtwF80U8M{y=OT}2BxY-wHnK>COXZ=-E44Yvjd1$mo*2AiC406@ms<<6~l%jre=t&H72!&DN@-!3jL z-kzPErOGF74%X(I4(Wu?>Wp&;Lx+zp4w%d|#ROi+xitT1!{e!aGaSM-{P9lPVPsij z^2P_*$X&elTq+0uDttEeYA|BsVcj>9sLG1=g^laB-4&Ddb4zGjFQ&WH2@fhW4_~K8gyF5!@WTdg*(Wgp`X+7NuLC3+XODt+9&xeMD*xTE~ zHYM!O9qJ1(zy38><~}B}k14lpKtxnj{{5^l_mDCXmpxe)MwF6Bsw=-tit5UISFAAt z-;Ub-?(m|!TTwKB{*f)NwI5}zmaPDat(p8@QdL#emip_axTIw7m3GP(YcwC=UJj*F zsY1wVxNhuNsd6(*mk$86QrEZX{L7jn`#K<=Xf)d5<;$0~y}dG{#j-?E zZvQ-&lu{+Z2TE$MaX8vGAB=eZL`h1!?c1*{K@fj#Xte?k$4kT}^rtjz&xKx{$V(F2 z=-O9xyc_Z}T7dj$%=2unkc6)%e$=Y1&gDpRs5 z4RZfTVE~fev0VI}7DJKo8#M5SI@G&Fu_OfXf`%)rcP2_qtfta^ zxjX#K%QKxe4*_6cvE=9|SpcjRSokr7YGlbM5*W_A+R19Esi|qs$lz2h$mr5flDU7hf9xVMV;`01g69$mgoq7lQx!je(q1otfA z zeo0U1Bfc7QGjXWjzrOMvQly|B-0tPz9DfY^HwJdj^qLn*i!e4e8lJkgZq$3@ll2wv zfx^zA)#OSpaM%|Tw!0>;A#;cQ=?ndyoi8~AKeL*dTl5Ls(sA+2q9RvXRm)28w?Xk} zIO_cYDpxN0+^NSnab}K~FwT;_N<&Ipg8zu&6NP~E;4={8 z2%ls0z90>2%1($3KVqsw+RN#P8wX+K#aTCjL&mw%Z?BZlW(=@)V{-A%X!%V5_UO1S|-{25Z)RxDMj+Y0rAe3}#$J{K|F`mX;T z6hv8q2D60Zd8{i*%U8YxB38kPP38>+ryDA3Pj!R<-kb|%*ax2X?{a79#yB9@ zBS|x9J22G7#zx`P3D40YF!@pfowCD@zu;32Z~mZ-qxoJ_ZH=GY#r5{il6LyE{D-o> z4QBGaBrHew#;>`I<9Uz7fb=!$U(q*y6a9~e&ewOvmBt)=%Tk(e*xw%&uA$u6=^p=> zX1AdE!tG-kd!k4QU3A)CpJPT?TU%#Ch_~#pm%JT(e11E+y1EvVf4m{Mu9TLFy0y3j z1O=^_I6FIEaB4!Cv6BRLU81_Wx_p%0siXOx*se(WiU0s;E#i;Qs2mDD**G3lsu;W{ zXekb4)iCZ4{j(|f*ZOaLHT@Lxwa$t~M(*&Ew2!avfZ7AZ9fky2m=e~VsABi1&)^|a zMa34A*A+TFw6=FPJT&x{d#Tb|;@+uI0yTnJ@afa1#6Wjm;{GqiM0a%nQ0d7DK)OUc zxVKc&IHRUo`^f;P)W>gc9eJM2nKfu`FOk1o9Hm#pmStxs6fwlmj!O5(JWZawFYE1v zpVE)vc4|OIzggZ=t~e(Ilq$_EZ~dI|gI!ZU>*5>DwZL_@gZYhSACuubtOw^9nVInG?1=GB^Uw~}bJMvNX9J<$sa_O2FV25kSXAzO#JtH9`)fh)>PH+3nZly&9xdqD z*w|@y)777pkpX~M+C=suW3fAQ`Z<YruJ}MX6%(&InK;2 zF3>+N2p$j<#0EeMrlkpm=|Hu#P@39s?elOQZFLw74ujc&eaQbM2#*ZBel_X;3oe;{ Ri)0G`D>GZu=f-{+{{izT(hvXu literal 2585 zcmX|Dc|6ql8=nK?CighUWVPj(!!gJ(&Pe3GkI@*$JuxvRs}YuQS6Yl?-N_xTB;}i3 z^2-@*37J7z$A)s2jh}Y+wV&7Pd4E37=XqZ5_v`)q^{^Zr&WQ-h3xYr(5nCHe=i{63 zE%^D4u_5&G90&xq3w8CRdD>qvB1K1P2L?r7B5TtlsmFB?$k>!l4J3t=X^2bYkkBYR za^q1i5)m4NM|$YlqwT2{WJ;(FBZln4aBw9t!byffNK+F*W4h5XK_r z@yNeLq_On>uZrPx>y9xP#dF`BCu!- z4u!^{FgjXjj1gMjNXHQI??IXfB8+2#f{mOlt^XA}&hSVIjYc&>q2lA?wc~ZPqhmr) z7(+ut6dH@dVzrJtv|-767@|4 z^{>jYJ=A~xj+6f;M22*l5_wKQ|3mwsR;WV?ANJu~f%-S7z}5vPPK z$WsxulxqF!H|v|#s=Cy)F$0tZbKU8BCziLuFP6L{%gCAxmh_r?V?XcZP(RXJjn3(+ z&X+P$MoP-gT-vCn0kBxTyT8BFOP*gO&d zPjyDlygY3oR*cV1SoI@5Uh((f<>6OSRNmt++r=kC?#vvb8O}Ln5rh)lw?@ou~hgGC?MjfZc6P|fHD#92zme9N?@&m^Pp*2 z0F*vxIRx5L$k&E47DlaxKuqz#zya(OS-|i2#vq>eWm#-+MQ5PHG#2-PI+FgHTNMIg z#`ZN8)N%lk8I+Xjl$^}RIe?>O;z!HD0}C-<^Ec93jHfy# z>U1{~xa~$8OJE$>6lM)JhEf!XrHdyG+||eNJc&2YTl1qKe+FUoDJkFu?giZL{OzKl zqr^_(K}d&u&qmI4ecY*<5vbQVQ@c!})6UQeGOcsnpQ+$4OwxHewX_&MPl>qSM-fKq zW!b-sh0zzjd`Zkw6UiJ`hW=)DI_)e*%-IUm*-@7Hk#8dlXmlj4C=z)Vg`S=N$sF44YupNLAD9<-Xa3avav);?beWq* z6xrR38E!few8YPIH@JY8`xOXr%JNf&l@fLmJs=;PUN($1Rm8sIZIP_>Y&n8oF1<(e zt92`yBMf?eUwd!QSg2#^!Qk*>GkU(HzOiJe=BmWD)L!LBGp*DUsj@C`0-P&F?PAbx zephs8GoE@v^3|o5eI@Ls9FIxYk4xbOVZVp3-PLiQAN;Z)dKKAH=J@CAI|%tg+a6x& zy6%4MUF#fa)o>+)WLoRS@~&?V#Y33qyoB>jkQ&duX@kOtOaawxYIwZpsC=!E8<xuXn&|YDP zg@-a+Za|a4ADnGYVc)f`-btvqqX7^-Y)n#pE3!rUB`(3w3_nGG*k402QQM=X{b2_97-V~D10(N0$ZIqP(?8(y_KInY3OMWDS& z#pk(>14{k9ai)a0qe62zhvuodFH=f9dMv2ym+iHmf$h_9vrFNfgC{+7g<^v8EG^yE>U2YJBe--rM!~VQ9V?+n%5=AWEwQ3 z27UTU@7Ej^T2b=4aI|@gzsGs#{k=FjqN8b9b;7GRLDJx3w=!spy|sZdLU%<8D)_#r zxIFs1Qduq}?~Pb%@W5uR+?u^6Vw+tn;P!JA>5UNcF`&+UvHZqcx9VW7AY{v~>&XAS z0k(L_?se#<`Rs}b)qGkYshgl)Qf+E;18*pMN@m7dW?B@QNL0OXHj}E?#_k9NT}Yk4 z_+lE{$%^;#i=EjKEde`8@)H|za@_Hm+c6(G({nNP*)p}GeEsvQT^$`(!^}cZFE|$m zHx;9+vuj>X9+5s|BdYCvNQkLQKOKihEUQ6TMY9 zLLs=fz6$fAT)*OSYI<;PFV7RfQWk7Ln69+RuGi~x(6xVCxOpf~Jh}P2o|9A8p^#h% z9)qqEI(l{6M7yN-6*uoTJmgD8S!Er8S0!8kdF~{zmz)ATV`>a7FM&A(yCqY;r0eHb zCnzG(&^e)5uTka*0OqCvhp8ietnyifs-(w%o@8d4r&(Q$goUAT&R)>J;_eswFayBX zvdhQL72m(*JusV#-S`DaFaEv=(*5}?l8t)p#mT8J>xR>1sXmH~GEgUY#m~27%&MD0Ui`Ji3&ArJ@ToT$(l2ELs#%87JP{# zYBb2_tj60?UAvz%zONjH{k~=53Sq0d>|Dczd6vwpZ5q6kv3&C5DyObJq-1>ZVPzWY z)_9Y#*e(BlYpsX!x~xw`(^YMR@fxhAQ8Vmqwcx95j5J6Pq(rrqW0y;MvRPa;gjSG!dw$?ra^Rr2er zQ+-LUIlV%@PU%tNdhawG^KLAE+J&I3uB_e>APpo3xFkT%IlY!TNvH;V`xG&`;A;(x zPB>j~ZB_14*ec0Qbxn4#|Y?F4IA=O)oRh-%4mlsw_k4sXIKjcC$TFd@? zuK6#U?RE9-{5dw^ks^M_K+43X_|!~0d5CvQ=mw)Gxts|4t9kU`HlRU?&{WCrMryy~ z@cU({QxwM86|8Ar+Tw$%&eifblNePyKvcKs2eF1<6I{uQ<9mF%h07HwqDKEgUG5Rs X{USSBeeGu0w~fx$%E7Y5oOu2J({haj