diff --git a/src/contrib/cluster/Akka.DistributedData/Replicator.Messages.cs b/src/contrib/cluster/Akka.DistributedData/Replicator.Messages.cs index e9800b7315c..8c7880ad900 100644 --- a/src/contrib/cluster/Akka.DistributedData/Replicator.Messages.cs +++ b/src/contrib/cluster/Akka.DistributedData/Replicator.Messages.cs @@ -21,10 +21,10 @@ public class GetKeyIds private GetKeyIds() { } - /// + public override bool Equals(object obj) => obj is GetKeyIds; - /// + public override int GetHashCode() => nameof(GetKeyIds).GetHashCode(); } @@ -38,11 +38,11 @@ public GetKeysIdsResult(IImmutableSet keys) Keys = keys; } - /// + public override bool Equals(object obj) => obj is GetKeysIdsResult && Equals((GetKeysIdsResult)obj); - /// + public bool Equals(GetKeysIdsResult other) { if (ReferenceEquals(other, null)) return false; @@ -51,10 +51,10 @@ public bool Equals(GetKeysIdsResult other) return Keys.SetEquals(other.Keys); } - /// + public override int GetHashCode() => Keys.GetHashCode(); - /// + public override string ToString() => $"GetKeysIdsResult({string.Join(", ", Keys)})"; } @@ -85,7 +85,7 @@ public Get(IKey key, IReadConsistency consistency, object request = null) Request = request; } - /// + public bool Equals(Get other) { if (ReferenceEquals(other, null)) return false; @@ -95,10 +95,10 @@ public bool Equals(Get other) Equals(Consistency, other.Consistency); } - /// + public override bool Equals(object obj) => obj is Get && Equals((Get)obj); - /// + public override int GetHashCode() { unchecked @@ -110,7 +110,7 @@ public override int GetHashCode() } } - /// + public override string ToString() => $"Get({Key}:{Consistency}{(Request == null ? "" : ", req=" + Request)})"; } @@ -181,7 +181,7 @@ public GetSuccess(IKey key, object request, IReplicatedData data) Data = data; } - /// + public bool Equals(GetSuccess other) { if (ReferenceEquals(other, null)) return false; @@ -190,10 +190,10 @@ public bool Equals(GetSuccess other) return Equals(Key, other.Key) && Equals(Request, other.Request) && Equals(Data, other.Data); } - /// + public override bool Equals(object obj) => obj is GetSuccess && Equals((GetSuccess)obj); - /// + public override int GetHashCode() { unchecked @@ -216,7 +216,7 @@ public T Get(IKey key) where T : IReplicatedData throw new InvalidCastException($"Response returned for key '{Key}' is of type [{Data?.GetType()}] and cannot be casted using key '{key}' to type [{typeof(T)}]"); } - /// + public override string ToString() => $"GetSuccess({Key}:{Data}{(Request == null ? "" : ", req=" + Request)})"; } @@ -241,13 +241,13 @@ public bool Equals(NotFound other) return Equals(Key, other.Key) && Equals(Request, other.Request); } - /// + public override bool Equals(object obj) => obj is NotFound && Equals((NotFound)obj); - /// + public override string ToString() => $"NotFound({Key}{(Request == null ? "" : ", req=" + Request)})"; - /// + public override int GetHashCode() { unchecked @@ -282,7 +282,7 @@ public GetFailure(IKey key, object request) Request = request; } - /// + public bool Equals(GetFailure other) { if (ReferenceEquals(other, null)) return false; @@ -291,10 +291,10 @@ public bool Equals(GetFailure other) return Equals(Key, other.Key) && Equals(Request, other.Request); } - /// + public override bool Equals(object obj) => obj is GetFailure && Equals((GetFailure)obj); - /// + public override int GetHashCode() { unchecked @@ -312,7 +312,7 @@ public T Get(IKey key) where T : IReplicatedData throw new TimeoutException($"A timeout occurred when trying to retrieve a value for key '{Key}' withing given read consistency"); } - /// + public override string ToString() => $"GetFailure({Key}{(Request == null ? "" : ", req=" + Request)})"; } @@ -342,7 +342,7 @@ public Subscribe(IKey key, IActorRef subscriber) Subscriber = subscriber; } - /// + public bool Equals(Subscribe other) { if (ReferenceEquals(other, null)) return false; @@ -351,10 +351,10 @@ public bool Equals(Subscribe other) return Equals(Key, other.Key) && Equals(Subscriber, other.Subscriber); } - /// + public override bool Equals(object obj) => obj is Subscribe && Equals((Subscribe)obj); - /// + public override int GetHashCode() { unchecked @@ -363,7 +363,7 @@ public override int GetHashCode() } } - /// + public override string ToString() => $"Subscribe({Key}, {Subscriber})"; } @@ -383,7 +383,7 @@ public Unsubscribe(IKey key, IActorRef subscriber) Subscriber = subscriber; } - /// + public bool Equals(Unsubscribe other) { if (ReferenceEquals(other, null)) return false; @@ -392,10 +392,10 @@ public bool Equals(Unsubscribe other) return Equals(Key, other.Key) && Equals(Subscriber, other.Subscriber); } - /// + public override bool Equals(object obj) => obj is Unsubscribe && Equals((Unsubscribe)obj); - /// + public override int GetHashCode() { unchecked @@ -404,7 +404,7 @@ public override int GetHashCode() } } - /// + public override string ToString() => $"Unsubscribe({Key}, {Subscriber})"; } @@ -432,7 +432,7 @@ public Changed(IKey key, object data) IKey IChanged.Key => Key; - /// + public bool Equals(Changed other) { if (ReferenceEquals(other, null)) return false; @@ -447,10 +447,10 @@ public T Get(IKey key) where T : IReplicatedData return (T)Data; } - /// + public override bool Equals(object obj) => obj is Changed && Equals((Changed)obj); - /// + public override int GetHashCode() { unchecked @@ -459,7 +459,7 @@ public override int GetHashCode() } } - /// + public override string ToString() => $"Changed({Key}:{Data})"; } @@ -515,7 +515,7 @@ public Update(IKey key, IReplicatedData initial, IWriteConsistency consistency, Modify = x => ModifyWithInitial(initial, modify, x); } - /// + public override string ToString() => $"Update({Key}, {Consistency}{(Request == null ? "" : ", req=" + Request)})"; } @@ -562,7 +562,7 @@ public UpdateSuccess(IKey key, object request) Request = request; } - /// + public bool Equals(UpdateSuccess other) { if (ReferenceEquals(other, null)) return false; @@ -571,10 +571,10 @@ public bool Equals(UpdateSuccess other) return Equals(Key, other.Key) && Equals(Request, other.Request); } - /// + public override bool Equals(object obj) => obj is UpdateSuccess && Equals((UpdateSuccess)obj); - /// + public override int GetHashCode() { unchecked @@ -583,7 +583,7 @@ public override int GetHashCode() } } - /// + public override string ToString() => $"UpdateSuccess({Key}{(Request == null ? "" : ", req=" + Request)})"; public bool IsSuccessful => true; @@ -621,7 +621,7 @@ public UpdateTimeout(IKey key, object request) Request = request; } - /// + public bool Equals(UpdateTimeout other) { if (ReferenceEquals(other, null)) return false; @@ -630,13 +630,13 @@ public bool Equals(UpdateTimeout other) return Equals(Key, other.Key) && Equals(Request, other.Request); } - /// + public override bool Equals(object obj) => obj is UpdateTimeout && Equals((UpdateTimeout)obj); - /// + public override string ToString() => $"UpdateTimeout({Key}{(Request == null ? "" : ", req=" + Request)})"; - /// + public override int GetHashCode() { unchecked @@ -674,7 +674,7 @@ public ModifyFailure(IKey key, string errorMessage, Exception cause, object requ Cause = cause; } - /// + public override string ToString() => $"ModifyFailure({Key}, {Cause}{(Request == null ? "" : ", req=" + Request)})"; public bool IsSuccessful => false; @@ -722,10 +722,10 @@ public void ThrowOnFailure() public Exception Cause => new Exception($"Failed to store value under the key {_key}"); - /// + public override string ToString() => $"StoreFailure({_key}{(_request == null ? "" : ", req=" + _request)})"; - /// + public bool Equals(StoreFailure other) { if (ReferenceEquals(null, other)) return false; @@ -733,7 +733,7 @@ public bool Equals(StoreFailure other) return Equals(_key, other._key) && Equals(_request, other._request); } - /// + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; @@ -741,7 +741,7 @@ public override bool Equals(object obj) return obj is StoreFailure && Equals((StoreFailure)obj); } - /// + public override int GetHashCode() { unchecked @@ -769,7 +769,7 @@ public Delete(IKey key, IWriteConsistency consistency, object request = null) Request = request; } - /// + public bool Equals(Delete other) { if (ReferenceEquals(other, null)) return false; @@ -778,10 +778,10 @@ public bool Equals(Delete other) return Equals(Key, other.Key) && Equals(Consistency, other.Consistency) && Equals(Request, other.Request); } - /// + public override bool Equals(object obj) => obj is Delete && Equals((Delete)obj); - /// + public override int GetHashCode() { unchecked @@ -790,7 +790,7 @@ public override int GetHashCode() } } - /// + public override string ToString() => $"Delete({Key}, {Consistency}{(Request == null ? "" : ", req=" + Request)})"; } @@ -843,7 +843,7 @@ public DeleteSuccess(IKey key, object request = null) public bool IsSuccessful => true; public bool AlreadyDeleted => false; - /// + public bool Equals(DeleteSuccess other) { if (ReferenceEquals(other, null)) return false; @@ -852,13 +852,13 @@ public bool Equals(DeleteSuccess other) return Equals(Key, other.Key); } - /// + public override bool Equals(object obj) => obj is DeleteSuccess && Equals((DeleteSuccess)obj); - /// + public override int GetHashCode() => Key.GetHashCode(); - /// + public override string ToString() => $"DeleteSuccess({Key}{(Request == null ? "" : ", req=" + Request)})"; } @@ -874,7 +874,7 @@ public ReplicationDeleteFailure(IKey key) public bool IsSuccessful => false; public bool AlreadyDeleted => false; - /// + public bool Equals(ReplicationDeleteFailure other) { if (ReferenceEquals(other, null)) return false; @@ -883,13 +883,13 @@ public bool Equals(ReplicationDeleteFailure other) return Equals(Key, other.Key); } - /// + public override bool Equals(object obj) => obj is ReplicationDeleteFailure && Equals((ReplicationDeleteFailure)obj); - /// + public override int GetHashCode() => Key.GetHashCode(); - /// + public override string ToString() => $"ReplicationDeletedFailure({Key})"; } @@ -907,10 +907,10 @@ public DataDeleted(IKey key, object request = null) public bool IsSuccessful => true; public bool AlreadyDeleted => true; - /// + public override string ToString() => $"DataDeleted({Key}{(Request == null ? "" : ", req=" + Request)})"; - /// + public bool Equals(DataDeleted other) { if (ReferenceEquals(other, null)) return false; @@ -919,10 +919,10 @@ public bool Equals(DataDeleted other) return Equals(Key, other.Key) && Equals(Request, other.Request); } - /// + public override bool Equals(object obj) => obj is DataDeleted && Equals((DataDeleted)obj); - /// + public override int GetHashCode() => Key.GetHashCode(); public bool IsFound => false; public bool IsFailure => true; @@ -963,16 +963,16 @@ public ReplicaCount(int n) N = n; } - /// + public bool Equals(ReplicaCount other) => other != null && N == other.N; - /// + public override bool Equals(object obj) => obj is ReplicaCount && Equals((ReplicaCount)obj); - /// + public override int GetHashCode() => N.GetHashCode(); - /// + public override string ToString() => $"ReplicaCount({N})"; } @@ -987,7 +987,7 @@ public sealed class FlushChanges private FlushChanges() { } - /// + public override bool Equals(object obj) { return obj is FlushChanges;