Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on akkadotnet#3414 - bringing SerializeWithTransport API up t…
Browse files Browse the repository at this point in the history
…o par with JVM
Aaronontheweb committed Mar 22, 2019
1 parent 37660ed commit 531c7eb
Showing 2 changed files with 51 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/core/Akka/Actor/ActorRefProvider.cs
Original file line number Diff line number Diff line change
@@ -10,18 +10,22 @@
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor.Internal;
using Akka.Annotations;
using Akka.Configuration;
using Akka.Dispatch;
using Akka.Dispatch.SysMsg;
using Akka.Event;
using Akka.Routing;
using Akka.Serialization;
using Akka.Util;
using Akka.Util.Internal;

namespace Akka.Actor
{
/// <summary>
/// TBD
/// The Actor Reference Provider API.
///
/// The factory used to produce and create <see cref="IActorRef"/> instances used inside an <see cref="ActorSystem"/>.
/// </summary>
public interface IActorRefProvider
{
@@ -133,6 +137,12 @@ public interface IActorRefProvider

/// <summary>Gets the external address of the default transport. </summary>
Address DefaultAddress { get; }

/// <summary>
/// INTERNAL API.
/// </summary>
[InternalApi]
Information SerializationInformation { get; }
}

/// <summary>
42 changes: 40 additions & 2 deletions src/core/Akka/Serialization/Serialization.cs
Original file line number Diff line number Diff line change
@@ -13,23 +13,61 @@
using System.Reflection;
using System.Runtime.Serialization;
using Akka.Actor;
using Akka.Annotations;
using Akka.Util.Internal;
using Akka.Util.Reflection;

namespace Akka.Serialization
{
/// <summary>
/// INTERNAL API.
///
/// Serialization information needed for serializing local actor refs.
/// </summary>
internal class Information
[InternalApi]
public sealed class Information : IEquatable<Information>
{
public Address Address { get; set; }

public ActorSystem System { get; set; }

public bool Equals(Information other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Address.Equals(other.Address) && System.Equals(other.System);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((Information)obj);
}

public override int GetHashCode()
{
unchecked
{
return (Address.GetHashCode() * 397) ^ System.GetHashCode();
}
}

public static bool operator ==(Information left, Information right)
{
return Equals(left, right);
}

public static bool operator !=(Information left, Information right)
{
return !Equals(left, right);
}
}

/// <summary>
/// TBD
/// The serialization system used by Akka.NET to serialize and deserialize objects
/// per the <see cref="ActorSystem"/>'s serialization configuration.
/// </summary>
public class Serialization
{

0 comments on commit 531c7eb

Please sign in to comment.