Skip to content

Commit

Permalink
Merge pull request #20 from vlingo-net/develop
Browse files Browse the repository at this point in the history
updated access modifiers
zpbappi authored Oct 27, 2018
2 parents 4d4ae5e + b6add11 commit f181a36
Showing 34 changed files with 138 additions and 94 deletions.
4 changes: 2 additions & 2 deletions src/Vlingo.Actors.Tests/ActorLifecycleTest.cs
Original file line number Diff line number Diff line change
@@ -42,13 +42,13 @@ public LifecycleActor(TestResults testResults)
this.testResults = testResults;
}

internal override void BeforeStart()
internal protected override void BeforeStart()
{
testResults.receivedBeforeStart.Set(true);
testResults.until.Happened();
}

internal override void AfterStop()
internal protected override void AfterStop()
{
testResults.receivedAfterStop.Set(true);
testResults.until.Happened();
4 changes: 2 additions & 2 deletions src/Vlingo.Actors.Tests/ActorStopTest.cs
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ public void CreateChildren()
ChildActorFor<IChildCreatingStoppable>(Definition.Has<ChildCreatingStoppableActor>(Definition.Parameters(testResults), $"{pre}.3"));
}

internal override void BeforeStart()
internal protected override void BeforeStart()
{
base.BeforeStart();
if (testResults.untilStart != null)
@@ -105,7 +105,7 @@ internal override void BeforeStart()
}

private static readonly object afterStopMutex = new object();
internal override void AfterStop()
internal protected override void AfterStop()
{
lock (afterStopMutex)
{
15 changes: 0 additions & 15 deletions src/Vlingo.Actors.Tests/Proxy/ProxyTest.cs

This file was deleted.

10 changes: 5 additions & 5 deletions src/Vlingo.Actors.Tests/Supervision/FailureControlActor.cs
Original file line number Diff line number Diff line change
@@ -42,35 +42,35 @@ public void FailNow()
throw new ApplicationException("Intended failure.");
}

internal override void BeforeStart()
internal protected override void BeforeStart()
{
testResults.BeforeStartCount.IncrementAndGet();
testResults.UntilFailNow.Happened();
base.BeforeStart();
}

internal override void AfterStop()
internal protected override void AfterStop()
{
testResults.AfterStopCount.IncrementAndGet();
testResults.UntilFailNow.Happened();
base.AfterStop();
}

internal override void BeforeRestart(Exception reason)
internal protected override void BeforeRestart(Exception reason)
{
testResults.BeforeRestartCount.IncrementAndGet();
testResults.UntilFailNow.Happened();
base.BeforeRestart(reason);
}

internal override void AfterRestart(Exception reason)
internal protected override void AfterRestart(Exception reason)
{
base.AfterRestart(reason);
testResults.AfterRestartCount.IncrementAndGet();
testResults.UntilAfterRestart.Happened();
}

internal override void BeforeResume(Exception reason)
internal protected override void BeforeResume(Exception reason)
{
testResults.BeforeResume.IncrementAndGet();
testResults.UntilBeforeResume.Happened();
31 changes: 17 additions & 14 deletions src/Vlingo.Actors/Actor.cs
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ protected T ChildActorFor<T>(Definition definition)
}
}

internal ICompletes<T> Completes<T>()
internal protected ICompletes<T> Completes<T>()
{
if(completes == null)
{
@@ -110,7 +110,7 @@ internal ICompletes<T> Completes<T>()

protected Definition Definition => LifeCycle.Definition;

internal ILogger Logger => LifeCycle.Environment.Logger;
internal protected ILogger Logger => LifeCycle.Environment.Logger;

protected T ParentAs<T>()
{
@@ -128,7 +128,7 @@ protected void Secure()
LifeCycle.Secure();
}

internal T SelfAs<T>()
internal protected T SelfAs<T>()
{
return LifeCycle.Environment.Stage.ActorProxyFor<T>(this, LifeCycle.Environment.Mailbox);
}
@@ -142,7 +142,7 @@ protected IOutcomeInterest<TOutcome> SelfAsOutcomeInterest<TOutcome, TRef>(TRef
return new OutcomeInterestActorProxy<TOutcome, TRef>(outcomeAware, reference);
}

internal Stage Stage
internal protected Stage Stage
{
get
{
@@ -155,26 +155,29 @@ internal Stage Stage
}
}

protected Stage StageNamed(string name)
internal protected Stage StageNamed(string name)
{
return LifeCycle.Environment.Stage.World.StageNamed(name);
}

//=======================================
// stowing/dispersing
//=======================================

internal bool IsDispersing =>
internal protected virtual bool IsDispersing =>
LifeCycle.Environment.Stowage.IsDispersing;


protected void DisperseStowedMessages()
internal protected virtual void DisperseStowedMessages()
{
LifeCycle.Environment.Stowage.DispersingMode();
}

internal bool IsStowing =>
internal protected virtual bool IsStowing =>
LifeCycle.Environment.Stowage.IsStowing;


protected void StowMessages()
internal protected virtual void StowMessages()
{
LifeCycle.Environment.Stowage.StowingMode();
}
@@ -183,29 +186,29 @@ protected void StowMessages()
// life cycle overrides
//=======================================

internal virtual void BeforeStart()
internal protected virtual void BeforeStart()
{
// override
}

internal virtual void AfterStop()
internal protected virtual void AfterStop()
{
// override
}

internal virtual void BeforeRestart(Exception reason)
internal protected virtual void BeforeRestart(Exception reason)
{
// override
LifeCycle.AfterStop(this);
}

internal virtual void AfterRestart(Exception reason)
internal protected virtual void AfterRestart(Exception reason)
{
// override
LifeCycle.BeforeStart(this);
}

internal virtual void BeforeResume(Exception reason)
internal protected virtual void BeforeResume(Exception reason)
{
// override
}
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/ActorFactory.cs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

namespace Vlingo.Actors
{
public class ActorFactory
internal class ActorFactory
{
internal static readonly ThreadLocal<Environment> ThreadLocalEnvironment = new ThreadLocal<Environment>(false);

2 changes: 1 addition & 1 deletion src/Vlingo.Actors/ActorProxy.cs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

namespace Vlingo.Actors
{
public sealed class ActorProxy
internal static class ActorProxy
{
private static readonly DynaClassLoader classLoader = new DynaClassLoader(typeof(ActorProxy).GetAssemblyLoadContext());
private static readonly DynaCompiler proxyCompiler = new DynaCompiler();
2 changes: 0 additions & 2 deletions src/Vlingo.Actors/AddressFactory.cs
Original file line number Diff line number Diff line change
@@ -39,7 +39,5 @@ public override string ToString()
=> $"AddressFactory[highId={highId.Get()}, nextId={nextId.Get()}]";

internal int TestNextIdValue() => nextId.Get();


}
}
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/CommonSupervisor.cs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

namespace Vlingo.Actors
{
public abstract class CommonSupervisor : DefaultSupervisor
internal abstract class CommonSupervisor : DefaultSupervisor
{
internal CommonSupervisor() { }
}
11 changes: 0 additions & 11 deletions src/Vlingo.Actors/Configuration.cs
Original file line number Diff line number Diff line change
@@ -19,17 +19,6 @@ namespace Vlingo.Actors
{
public class Configuration
{
private ConcurrentQueueMailboxPluginConfiguration concurrentQueueMailboxPluginConfiguration;
private CommonSupervisorsPluginConfiguration commonSupervisorsPluginConfiguration;
private DefaultSupervisorOverridePluginConfiguration defaultSupervisorOverridePluginConfiguration;
private ConsoleLoggerPluginConfiguration jdkLoggerPluginConfiguration;
private PooledCompletesPluginConfiguration pooledCompletesPluginConfiguration;
private ManyToOneConcurrentArrayQueuePluginConfiguration manyToOneConcurrentArrayQueuePluginConfiguration;
private SharedRingBufferMailboxPluginConfiguration sharedRingBufferMailboxPluginConfiguration;
private string mainProxyGeneratedClassesPath;
private string mainProxyGeneratedSourcesPath;
private string testProxyGeneratedClassesPath;
private string testProxyGeneratedSourcesPath;
private List<IPlugin> plugins;

public static Configuration Define() => new Configuration();
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/DeadLettersActor.cs
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ public void RegisterListener(IDeadLettersListener listener)
listeners.Add(listener);
}

internal override void AfterStop()
internal protected override void AfterStop()
{
Stage.World.DeadLetters = null;
base.AfterStop();
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/Definition.cs
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ namespace Vlingo.Actors
// TODO: possible removal/cleanup of overloaded ctors
public sealed class Definition
{
internal static readonly List<object> NoParameters = new List<object>();
public static readonly List<object> NoParameters = new List<object>();

public static Definition Has<T>(List<object> parameters) where T : Actor
=> new Definition(typeof(T), parameters);
4 changes: 2 additions & 2 deletions src/Vlingo.Actors/Directory.cs
Original file line number Diff line number Diff line change
@@ -12,11 +12,11 @@

namespace Vlingo.Actors
{
public sealed class Directory
internal sealed class Directory
{
private readonly ConcurrentDictionary<Address, Actor>[] maps;

public Directory()
internal Directory()
{
maps = Build();
}
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/DirectoryScannerActor.cs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

namespace Vlingo.Actors
{
public class DirectoryScannerActor : Actor, IDirectoryScanner
internal class DirectoryScannerActor : Actor, IDirectoryScanner
{
private readonly Directory directory;

2 changes: 1 addition & 1 deletion src/Vlingo.Actors/Environment.cs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

namespace Vlingo.Actors
{
public class Environment
internal class Environment
{
internal Address Address { get; }
internal List<Actor> Children { get; }
4 changes: 2 additions & 2 deletions src/Vlingo.Actors/FailureMark.cs
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ public FailureMark()
Reset();
}

protected internal bool FailedWithExcessiveFailures(long period, int intensity)
protected internal virtual bool FailedWithExcessiveFailures(long period, int intensity)
{
if (intensity == SupervisionStrategyConstants.ForeverIntensity)
{
@@ -58,7 +58,7 @@ protected internal bool FailedWithExcessiveFailures(long period, int intensity)
return false;
}

protected internal void Reset()
protected internal virtual void Reset()
{
startOfPeriod = 0;
timedIntensity = 0;
1 change: 0 additions & 1 deletion src/Vlingo.Actors/FailureOutcome.cs
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ public class FailureOutcome<T> : Outcome<T>
{
public FailureOutcome(T value) : base(value)
{

}
}
}
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/ICompletes.cs
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ public interface ICompletes<T> : ICompletes
ICompletes<T> AndThen(Action<T> consumer);
ICompletes<T> AtLast(Action<T> consumer);
ICompletes<T> AtLast(Func<T> supplier);
T Outcome { get; }
new T Outcome { get; }
ICompletes<TOutcome> With<TOutcome>(TOutcome outcome);
}

4 changes: 2 additions & 2 deletions src/Vlingo.Actors/ICompletesEventually.cs
Original file line number Diff line number Diff line change
@@ -14,9 +14,9 @@ public interface ICompletesEventually : IStoppable

public abstract class CompletesEventually : ICompletesEventually
{
public bool IsStopped => false;
public virtual bool IsStopped => false;

public void Stop()
public virtual void Stop()
{
}

4 changes: 2 additions & 2 deletions src/Vlingo.Actors/LifeCycle.cs
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@

namespace Vlingo.Actors
{
public sealed class LifeCycle
internal sealed class LifeCycle
{

public Environment Environment { get; set; }
internal Environment Environment { get; set; }

internal LifeCycle(Environment environment)
{
4 changes: 2 additions & 2 deletions src/Vlingo.Actors/LocalMessage.cs
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ public LocalMessage(LocalMessage<T> message)

private Action<T> Consumer { get; }

public void Deliver()
public virtual void Deliver()
{
if (Actor.LifeCycle.IsResuming)
{
@@ -59,7 +59,7 @@ public void Deliver()
}
}

public string Representation { get; }
public virtual string Representation { get; }

public virtual bool IsStowed => false;

66 changes: 66 additions & 0 deletions src/Vlingo.Actors/Logger__Proxy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright (c) 2012-2018 Vaughn Vernon. 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
{
public class Logger__Proxy : ILogger
{
private const string LogRepresentation1 = "Log(string)";
private const string LogRepresentation2 = "Log(string, Exception)";
private const string CloseRepresentation3 = "Close()";

private readonly Actor actor;
private readonly IMailbox mailbox;

public Logger__Proxy(Actor actor, IMailbox mailbox)
{
this.actor = actor;
this.mailbox = mailbox;
}
public bool IsEnabled => false;
public string Name => null;

public void Log(string message)
{
if (!actor.IsStopped)
{
Action<ILogger> consumer = actor => actor.Log(message);
mailbox.Send(new LocalMessage<ILogger>(actor, consumer, LogRepresentation1));
}
else
{
actor.DeadLetters.FailedDelivery(new DeadLetter(actor, LogRepresentation1));
}
}
public void Log(string message, Exception ex)
{
if (!actor.IsStopped)
{
Action<ILogger> consumer = actor => actor.Log(message, ex);
mailbox.Send(new LocalMessage<ILogger>(actor, consumer, LogRepresentation2));
}
else
{
actor.DeadLetters.FailedDelivery(new DeadLetter(actor, LogRepresentation2));
}
}
public void Close()
{
if (!actor.IsStopped)
{
Action<ILogger> consumer = actor => actor.Close();
mailbox.Send(new LocalMessage<ILogger>(actor, consumer, CloseRepresentation3));
}
else
{
actor.DeadLetters.FailedDelivery(new DeadLetter(actor, CloseRepresentation3));
}
}
}
}
4 changes: 2 additions & 2 deletions src/Vlingo.Actors/OutcomeInterestActorProxy.cs
Original file line number Diff line number Diff line change
@@ -20,12 +20,12 @@ public OutcomeInterestActorProxy(
this.reference = reference;
}

public void FailureOutcome(Outcome<TOutcome> outcome)
public virtual void FailureOutcome(Outcome<TOutcome> outcome)
{
outcomeAware.FailureOutcome(outcome, reference);
}

public void SuccessfulOutcome(Outcome<TOutcome> outcome)
public virtual void SuccessfulOutcome(Outcome<TOutcome> outcome)
{
outcomeAware.SuccessfulOutcome(outcome, reference);
}
5 changes: 5 additions & 0 deletions src/Vlingo.Actors/Plugin/AbstractPlugin.cs
Original file line number Diff line number Diff line change
@@ -25,5 +25,10 @@ public override bool Equals(object obj)

return string.Equals(Name, ((IPlugin)obj).Name);
}

public override int GetHashCode()
{
return $"{GetType().FullName}::{Name}".GetHashCode();
}
}
}
6 changes: 3 additions & 3 deletions src/Vlingo.Actors/PooledCompletes.cs
Original file line number Diff line number Diff line change
@@ -27,15 +27,15 @@ public PooledCompletes(

public object Outcome { get; private set; }

public void With(object outcome)
public virtual void With(object outcome)
{
Outcome = outcome;
CompletesEventually.With(this);
}

public bool IsStopped => CompletesEventually.IsStopped;
public virtual bool IsStopped => CompletesEventually.IsStopped;

public void Stop()
public virtual void Stop()
{
}
}
4 changes: 2 additions & 2 deletions src/Vlingo.Actors/PrivateRootActor.cs
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@

namespace Vlingo.Actors
{
public class PrivateRootActor : Actor, IStoppable, ISupervisor
public sealed class PrivateRootActor : Actor, IStoppable, ISupervisor
{
public ISupervisionStrategy SupervisionStrategy { get; }

@@ -38,7 +38,7 @@ public PrivateRootActor()
Logger);
}

internal override void AfterStop()
internal protected override void AfterStop()
{
Stage.World.SetPrivateRoot(null);
base.AfterStop();
4 changes: 2 additions & 2 deletions src/Vlingo.Actors/ProxyGenerator.cs
Original file line number Diff line number Diff line change
@@ -18,9 +18,9 @@

namespace Vlingo.Actors
{
public class ProxyGenerator
internal class ProxyGenerator
{
public sealed class Result
internal sealed class Result
{
internal Result(
string fullyQualifiedClassName,
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/PublicRootActor.cs
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ public void Inform(Exception error, ISupervised supervised)
supervised.RestartWithin(SupervisionStrategy.Period, SupervisionStrategy.Intensity, SupervisionStrategy.Scope);
}

internal override void AfterStop()
internal protected override void AfterStop()
{
Stage.World.SetDefaultParent(null);
Stage.World.SetPublicRoot(null);
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/Stage.cs
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ public TestActor<T> TestActorFor<T>(Definition definition)
}
}

public Protocols TestActorFor(Definition definition, Type[] protocols)
internal Protocols TestActorFor(Definition definition, Type[] protocols)
{
var redefinition = Definition.Has(
definition.Type,
16 changes: 8 additions & 8 deletions src/Vlingo.Actors/StageSupervisedActor.cs
Original file line number Diff line number Diff line change
@@ -21,11 +21,11 @@ protected internal StageSupervisedActor(Actor actor, Exception error)
Error = error;
}

public Address Address => actor.Address;
public virtual Address Address => actor.Address;

public void Escalate() => Supervisor.Supervisor.Inform(Error, this);
public virtual void Escalate() => Supervisor.Supervisor.Inform(Error, this);

public void RestartWithin(long period, int intensity, Scope scope)
public virtual void RestartWithin(long period, int intensity, Scope scope)
{
if (FailureThresholdReached(period, intensity))
{
@@ -47,13 +47,13 @@ public void RestartWithin(long period, int intensity, Scope scope)
}
}

public void Resume()
public virtual void Resume()
{
actor.LifeCycle.BeforeResume<T>(actor, Error);
actor.LifeCycle.Resume();
}

public void Stop(Scope scope)
public virtual void Stop(Scope scope)
{
if(scope == Scope.One)
{
@@ -68,11 +68,11 @@ public void Stop(Scope scope)
}
}

public void Suspend() => actor.LifeCycle.Suspend();
public virtual void Suspend() => actor.LifeCycle.Suspend();

public ISupervisor Supervisor => actor.LifeCycle.Supervisor<T>();
public virtual ISupervisor Supervisor => actor.LifeCycle.Supervisor<T>();

public Exception Error { get; }
public virtual Exception Error { get; }

private IEnumerable<Actor> SelfWithSiblings()
=> EnvironmentOf(EnvironmentOf(actor).Parent).Children;
4 changes: 2 additions & 2 deletions src/Vlingo.Actors/Stowage.cs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

namespace Vlingo.Actors
{
public class Stowage
internal class Stowage
{
private Queue<IMessage> stowedMessages;
private AtomicBoolean dispersing;
@@ -36,7 +36,7 @@ protected internal void Dump(ILogger logger)

protected internal bool HasMessages => stowedMessages.Count > 0;

internal IMessage Head
protected internal IMessage Head
{
get
{
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/TestKit/TestEnvironment.cs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

namespace Vlingo.Actors.TestKit
{
public class TestEnvironment : Environment
internal class TestEnvironment : Environment
{
public TestEnvironment() :
base(
2 changes: 1 addition & 1 deletion src/Vlingo.Actors/Vlingo.Actors.csproj
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

<!-- NuGet Metadata -->
<IsPackable>true</IsPackable>
<PackageVersion>0.1.0</PackageVersion>
<PackageVersion>0.1.1</PackageVersion>
<PackageId>Vlingo.Actors</PackageId>
<Authors>Vlingo</Authors>
<Description>
1 change: 0 additions & 1 deletion src/Vlingo.Actors/World.cs
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@

using System;
using System.Collections.Generic;
using Vlingo.Actors.Plugin;
using Vlingo.Common.Compiler;

namespace Vlingo.Actors

0 comments on commit f181a36

Please sign in to comment.