Skip to content

Commit

Permalink
Merge pull request #781 from HCanber/rename-interfaces
Browse files Browse the repository at this point in the history
Rename interfaces
  • Loading branch information
Aaronontheweb committed Apr 1, 2015
2 parents 58f0437 + 05dda34 commit 0ad8ce2
Show file tree
Hide file tree
Showing 51 changed files with 186 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Akka.DI.Core
/// <summary>
/// Dependency Injection Backed IndirectActorProducer
/// </summary>
public class DIActorProducer : IndirectActorProducer
public class DIActorProducer : IIndirectActorProducer
{
private IDependencyResolver dependencyResolver;
private string actorName;
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Persistence/GuaranteedDelivery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected MaxUnconfirmedMessagesExceededException(SerializationInfo info, Stream
/// Support for snapshot is provided by get and set delivery snapshot methods. These snapshots contains full
/// delivery state including unconfirmed messages. For custom snapshots remember to include those delivery ones.
/// </summary>
public abstract class GuaranteedDeliveryActor : PersistentActor, InitializableActor
public abstract class GuaranteedDeliveryActor : PersistentActor, IInitializableActor
{
private ICancelable _redeliverScheduleCancelable;
private long _deliverySequenceNr = 0L;
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Persistence/PersistentActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ protected void BecomeStacked(UntypedReceive receive)
protected static new IUntypedActorContext Context { get { return (IUntypedActorContext)ActorBase.Context; } }
}

public abstract class ReceivePersistentActor : UntypedPersistentActor, InitializableActor
public abstract class ReceivePersistentActor : UntypedPersistentActor, IInitializableActor
{

private bool _shouldUnhandle = true;
Expand All @@ -194,7 +194,7 @@ protected ReceivePersistentActor()
PrepareConfigureMessageHandlers();
}

void InitializableActor.Init()
void IInitializableActor.Init()
{
//This might be called directly after the constructor, or when the same actor instance has been returned
//during recreate. Make sure what happens here is idempotent
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Remote/Endpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void Dispatch(IInternalActorRef recipient, Address recipientAddress, Seri
}

//message is intended for a local recipient
else if ((recipient is LocalRef || recipient is RepointableActorRef) && recipient.IsLocal)
else if ((recipient is ILocalRef || recipient is RepointableActorRef) && recipient.IsLocal)
{
if (settings.LogReceive) log.Debug("received local message [{0}]", msgLog);
payload.Match()
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Remote/RemoteActorRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Akka.Remote
/// Marker interface for Actors that are deployed in a remote scope
/// </summary>
// ReSharper disable once InconsistentNaming
internal interface RemoteRef : ActorRefScope { }
internal interface RemoteRef : IActorRefScope { }

/// <summary>
/// Class RemoteActorRef.
Expand Down Expand Up @@ -77,7 +77,7 @@ public override IInternalActorRef Parent
/// Gets the provider.
/// </summary>
/// <value>The provider.</value>
public override ActorRefProvider Provider
public override IActorRefProvider Provider
{
get { return Remote.Provider; }
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Remote/RemoteActorRefProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Akka.Remote
/// <summary>
/// INTERNAL API
/// </summary>
public class RemoteActorRefProvider : ActorRefProvider
public class RemoteActorRefProvider : IActorRefProvider
{
private readonly LoggingAdapter _log;

Expand Down Expand Up @@ -460,7 +460,7 @@ private void InitFSM()

private class RemoteDeadLetterActorRef : DeadLetterActorRef
{
public RemoteDeadLetterActorRef(ActorRefProvider provider, ActorPath actorPath, EventStream eventStream)
public RemoteDeadLetterActorRef(IActorRefProvider provider, ActorPath actorPath, EventStream eventStream)
: base(provider, actorPath, eventStream)
{
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.TestKit/Internal/InternalTestActorRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected override void AutoReceiveMessage(Envelope envelope)
}


public class InternalGetActor : AutoReceivedMessage, PossiblyHarmful
public class InternalGetActor : IAutoReceivedMessage, PossiblyHarmful
{
public static readonly InternalGetActor Instance = new InternalGetActor();
private InternalGetActor() { }
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.TestKit/TestActorRefBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ ISurrogate ISurrogated.ToSurrogate(ActorSystem system)
return _internalRef.ToSurrogate(system);
}

bool ActorRefScope.IsLocal { get { return _internalRef.IsLocal; } }
bool IActorRefScope.IsLocal { get { return _internalRef.IsLocal; } }

IInternalActorRef IInternalActorRef.Parent { get { return _internalRef.Parent; } }

ActorRefProvider IInternalActorRef.Provider { get { return _internalRef.Provider; } }
IActorRefProvider IInternalActorRef.Provider { get { return _internalRef.Provider; } }

bool IInternalActorRef.IsTerminated { get { return _internalRef.IsTerminated; } }

Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.TestKit/TestFSMRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void SetState(TState stateName, TimeSpan? timeout = null)
/// </summary>
public void SetState(TState stateName, TData stateData, TimeSpan? timeout = null, FSMBase.Reason stopReason = null)
{
var fsm = ((InternalSupportsTestFSMRef<TState, TData>)UnderlyingActor);
var fsm = ((IInternalSupportsTestFSMRef<TState, TData>)UnderlyingActor);
InternalRef.Cell.UseThreadContext(() => fsm.ApplyState(new FSMBase.State<TState, TData>(stateName, stateData, timeout, stopReason)));
}

Expand Down Expand Up @@ -98,7 +98,7 @@ public bool IsTimerActive(string name)
/// <returns><c>true</c> if the FSM has a active state timer active; <c>false</c> otherwise</returns>
public bool IsStateTimerActive()
{
var fsm = ((InternalSupportsTestFSMRef<TState, TData>)UnderlyingActor);
var fsm = ((IInternalSupportsTestFSMRef<TState, TData>)UnderlyingActor);
return fsm.IsStateTimerActive;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.TestKit/TestKitBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private TestKitBase(TestKitAssertions assertions, ActorSystem system, Config con
//Wait for the testactor to start
AwaitCondition(() =>
{
var repRef = testActor as RepointableRef;
var repRef = testActor as IRepointableRef;
return repRef == null || repRef.IsStarted;
}, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(10));

Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.TestKit/TestProbe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ ISurrogate ISurrogated.ToSurrogate(ActorSystem system)
return TestActor.ToSurrogate(system);
}

bool ActorRefScope.IsLocal { get { return ((IInternalActorRef) TestActor).IsLocal; } }
bool IActorRefScope.IsLocal { get { return ((IInternalActorRef) TestActor).IsLocal; } }

IInternalActorRef IInternalActorRef.Parent { get { return ((IInternalActorRef)TestActor).Parent; } }

ActorRefProvider IInternalActorRef.Provider { get { return ((IInternalActorRef)TestActor).Provider; } }
IActorRefProvider IInternalActorRef.Provider { get { return ((IInternalActorRef)TestActor).Provider; } }

bool IInternalActorRef.IsTerminated { get { return ((IInternalActorRef)TestActor).IsTerminated; } }

Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Tests/Actor/PropsSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void Props_must_create_actor_by_producer()
latchActor.Ready(TimeSpan.FromSeconds(1));
}

private class TestProducer : IndirectActorProducer
private class TestProducer : IIndirectActorProducer
{
TestLatch latchActor;

Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Tests/Actor/RootGuardianActorRef_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public override ActorPath Path
get { return _path; }
}

public override ActorRefProvider Provider
public override IActorRefProvider Provider
{
get { throw new System.NotImplementedException(); }
}
Expand Down
32 changes: 16 additions & 16 deletions src/core/Akka/Actor/ActorCell.Children.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ namespace Akka.Actor
{
public partial class ActorCell
{
private ChildrenContainer _childrenContainerDoNotCallMeDirectly = EmptyChildrenContainer.Instance;
private IChildrenContainer _childrenContainerDoNotCallMeDirectly = EmptyChildrenContainer.Instance;
private long _nextRandomNameDoNotCallMeDirectly;

[Obsolete("Use ChildrenContainer instead", true)]
private ChildrenContainer ChildrenRefs
private IChildrenContainer ChildrenRefs
{
get { return ChildrenContainer; }
}

private ChildrenContainer ChildrenContainer
private IChildrenContainer ChildrenContainer
{
get { return _childrenContainerDoNotCallMeDirectly; } //TODO: Hmm do we need memory barriers here???
}
Expand All @@ -30,7 +30,7 @@ private IReadOnlyCollection<IActorRef> Children

private bool TryGetChild(string name, out IActorRef child)
{
ChildStats stats;
IChildStats stats;
if (ChildrenContainer.TryGetByName(name, out stats))
{
var restartStats = stats as ChildRestartStats;
Expand Down Expand Up @@ -104,7 +104,7 @@ private void SwapChildrenRefs() { }
/// </summary>
/// <param name="updater">A function that returns a new container.</param>
/// <returns>The third value of the tuple that <paramref name="updater"/> returned.</returns>
private TReturn UpdateChildrenRefs<TReturn>(Func<ChildrenContainer, Tuple<bool, ChildrenContainer, TReturn>> updater)
private TReturn UpdateChildrenRefs<TReturn>(Func<IChildrenContainer, Tuple<bool, IChildrenContainer, TReturn>> updater)
{
return InterlockedSpin.ConditionallySwap(ref _childrenContainerDoNotCallMeDirectly, updater);
}
Expand All @@ -117,7 +117,7 @@ private TReturn UpdateChildrenRefs<TReturn>(Func<ChildrenContainer, Tuple<bool,
/// </summary>
/// <param name="updater">A function that returns a new container.</param>
/// <returns>The new updated <see cref="ChildrenContainer"/></returns>
private ChildrenContainer UpdateChildrenRefs(Func<ChildrenContainer, ChildrenContainer> updater)
private IChildrenContainer UpdateChildrenRefs(Func<IChildrenContainer, IChildrenContainer> updater)
{
return InterlockedSpin.Swap(ref _childrenContainerDoNotCallMeDirectly, updater);
}
Expand All @@ -138,26 +138,26 @@ public ChildRestartStats InitChild(IInternalActorRef actor)
{
return UpdateChildrenRefs(cc =>
{
ChildStats stats;
IChildStats stats;
var name = actor.Path.Name;
if (cc.TryGetByName(name, out stats))
{
var old = stats as ChildRestartStats;
if (old != null)
{
//Do not update. Return old
return new Tuple<bool, ChildrenContainer, ChildRestartStats>(false, cc, old);
return new Tuple<bool, IChildrenContainer, ChildRestartStats>(false, cc, old);
}
if (stats is ChildNameReserved)
{
var crs = new ChildRestartStats(actor);
var updatedContainer = cc.Add(name, crs);
//Update (if it's still cc) and return the new crs
return new Tuple<bool, ChildrenContainer, ChildRestartStats>(true, updatedContainer, crs);
return new Tuple<bool, IChildrenContainer, ChildRestartStats>(true, updatedContainer, crs);
}
}
//Do not update. Return null
return new Tuple<bool, ChildrenContainer, ChildRestartStats>(false, cc, null);
return new Tuple<bool, IChildrenContainer, ChildRestartStats>(false, cc, null);
});
}

Expand All @@ -168,10 +168,10 @@ protected bool SetChildrenTerminationReason(SuspendReason reason)
var c = cc as TerminatingChildrenContainer;
if (c != null)
//The arguments says: Update; with a new reason; and return true
return new Tuple<bool, ChildrenContainer, bool>(true, c.CreateCopyWithReason(reason), true);
return new Tuple<bool, IChildrenContainer, bool>(true, c.CreateCopyWithReason(reason), true);

//The arguments says:Do NOT update; any container will do since it wont be updated; return false
return new Tuple<bool, ChildrenContainer, bool>(false, cc, false);
return new Tuple<bool, IChildrenContainer, bool>(false, cc, false);
});
}

Expand All @@ -188,7 +188,7 @@ protected void SetTerminated()
get
{
var terminating = ChildrenContainer as TerminatingChildrenContainer;
return terminating != null && terminating.Reason is SuspendReason.WaitingForChildren;
return terminating != null && terminating.Reason is SuspendReason.IWaitingForChildren;
}
}

Expand Down Expand Up @@ -234,7 +234,7 @@ private void ResumeChildren(Exception causedByFailure, IActorRef perpetrator)
/// indicating that only a name has been reserved for the child, or a <see cref="ChildRestartStats"/> for a child that
/// has been initialized/created.
/// </summary>
public bool TryGetChildStatsByName(string name, out ChildStats child) //This is called getChildByName in Akka JVM
public bool TryGetChildStatsByName(string name, out IChildStats child) //This is called getChildByName in Akka JVM
{
return ChildrenContainer.TryGetByName(name, out child);
}
Expand All @@ -244,7 +244,7 @@ public bool TryGetChildStatsByName(string name, out ChildStats child) //This i
/// </summary>
private bool TryGetChildRestartStatsByName(string name, out ChildRestartStats child)
{
ChildStats stats;
IChildStats stats;
if (ChildrenContainer.TryGetByName(name, out stats))
{
child = stats as ChildRestartStats;
Expand All @@ -257,7 +257,7 @@ private bool TryGetChildRestartStatsByName(string name, out ChildRestartStats ch

/// <summary>
/// Tries to get the stats for the specified child.
/// <remarks>Since the child exists <see cref="ChildRestartStats"/> is the only valid <see cref="ChildStats"/>.</remarks>
/// <remarks>Since the child exists <see cref="ChildRestartStats"/> is the only valid <see cref="IChildStats"/>.</remarks>
/// </summary>
protected bool TryGetChildStatsByRef(IActorRef actor, out ChildRestartStats child) //This is called getChildByRef in Akka JVM
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka/Actor/ActorCell.DeathWatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected void TellWatchersWeDied()

private void SendTerminated(bool ifLocal, IActorRef watcher)
{
if (((ActorRefScope)watcher).IsLocal == ifLocal && !watcher.Equals(Parent))
if (((IActorRefScope)watcher).IsLocal == ifLocal && !watcher.Equals(Parent))
{
((IInternalActorRef)watcher).Tell(new DeathWatchNotification(Self, true, false));
}
Expand Down Expand Up @@ -280,7 +280,7 @@ public override ActorPath Path
get { return _ref.Path.WithUid(ActorCell.UndefinedUid); }
}

public override ActorRefProvider Provider
public override IActorRefProvider Provider
{
get
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka/Actor/ActorCell.DefaultMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void Invoke(Envelope envelope)

try
{
var autoReceivedMessage = message as AutoReceivedMessage;
var autoReceivedMessage = message as IAutoReceivedMessage;
if (autoReceivedMessage != null)
AutoReceiveMessage(envelope);
else
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka/Actor/ActorCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Akka.Actor
{
public partial class ActorCell : IUntypedActorContext, Cell
public partial class ActorCell : IUntypedActorContext, ICell
{
/// <summary>NOTE! Only constructor and ClearActorFields is allowed to update this</summary>
private IInternalActorRef _self;
Expand Down Expand Up @@ -217,7 +217,7 @@ protected virtual ActorBase CreateNewActorInstance()
var pipeline = _systemImpl.ActorPipelineResolver.ResolvePipeline(actor.GetType());
pipeline.AfterActorIncarnated(actor, this);

var initializableActor = actor as InitializableActor;
var initializableActor = actor as IInitializableActor;
if(initializableActor != null)
{
initializableActor.Init();
Expand Down
Loading

0 comments on commit 0ad8ce2

Please sign in to comment.