예제 #1
0
        /// <inheritdoc />
        public override bool DataEquals(IRingMasterBackendRequest obj)
        {
            BackendRequestWithContext<TRequest, TReturn> other = obj as BackendRequestWithContext<TRequest, TReturn>;

            // note we don't need to validate the request type because the previous check covers us on that
            if (this.Uid != other?.Uid)
            {
                return false;
            }

            if (this.ExecutionQueueTimeoutMillis != other.ExecutionQueueTimeoutMillis)
            {
                return false;
            }

            if (Guid.Equals(this.ExecutionQueueId, other.ExecutionQueueId))
            {
                return false;
            }

            if (!string.Equals(this.Path, other.Path))
            {
                return false;
            }

            return EqualityHelper.Equals(this.context, other.context);
        }
예제 #2
0
        /// <summary>
        /// Determines whether the specified <see cref="object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
        /// <returns><c>true</c> if the specified object is equal to this instance; otherwise, <c>false</c>.</returns>
        public override bool Equals(object obj)
        {
            RequestCreate other = obj as RequestCreate;

            if (other == null)
            {
                return(false);
            }

            if (!base.Equals(obj))
            {
                return(false);
            }

            if (this.CreateMode != other.CreateMode)
            {
                return(false);
            }

            if (!EqualityHelper.Equals(this.Acl, other.Acl))
            {
                return(false);
            }

            return(EqualityHelper.Equals(this.Data, other.Data));
        }
예제 #3
0
        /// <summary>
        /// Determines whether the specified <see cref="object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
        /// <returns><c>true</c> if the specified object is equal to this instance; otherwise, <c>false</c>.</returns>
        public override bool Equals(object obj)
        {
            RequestGetChildren other = obj as RequestGetChildren;

            if (other == null)
            {
                return(false);
            }

            if (!this.DataEquals(other))
            {
                return(false);
            }

            if (!string.Equals(this.RetrievalCondition, other.RetrievalCondition))
            {
                return(false);
            }

            if (this.Watcher == other.Watcher)
            {
                return(true);
            }

            return(EqualityHelper.Equals(this.Watcher, other.Watcher));
        }
예제 #4
0
 /// <summary>
 /// A value indicating whether the specified instance is equal to this instance.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns><c>true</c> if the instances are equal.</returns>
 public bool Equals(UnitFlatIdentifierRepresentation other)
 {
     return(EqualityHelper.Equals(
                this,
                other,
                obj => this.UnitExpression.Equals(other.UnitExpression) && this.Exponent.Equals(obj.Exponent)));
 }
예제 #5
0
        /// <summary>
        /// Determines whether the specified <see cref="object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
        /// <returns><c>true</c> if the specified object is equal to this instance; otherwise, <c>false</c>.</returns>
        public override bool Equals(object obj)
        {
            RequestGetData other = obj as RequestGetData;

            if (other == null)
            {
                return(false);
            }

            if (!this.DataEquals(other))
            {
                return(false);
            }

            if (this.Watcher != other.Watcher)
            {
                return(false);
            }

            if (this.Options != other.Options)
            {
                return(false);
            }

            return(EqualityHelper.Equals(this.Watcher, other.Watcher));
        }
예제 #6
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other">other</paramref> parameter; otherwise, false.
 /// </returns>
 public bool Equals(PlayerStatus?other)
 {
     return(EqualityHelper.Equals(this, other, rhs => this.PlaylistName == rhs.PlaylistName &&
                                  this.Artist == rhs.Artist &&
                                  this.Title == rhs.Title &&
                                  this.State == rhs.State &&
                                  this.Track == rhs.Track &&
                                  this.Elapsed == rhs.Elapsed));
 }
예제 #7
0
 public static bool Equals <T>(ref T left, ref T right) where T : struct
 {
     #if !UNITY_CSHARP_TINY
     var typeInfo = TypeManager.GetTypeInfo <T>().FastEqualityTypeInfo;
     return(FastEquality.Equals(ref left, ref right, typeInfo));
     #else
     return(EqualityHelper <T> .Equals(left, right));
     #endif
 }
예제 #8
0
 public bool Equals(MusicPlayerEventArgs?other)
 {
     return(EqualityHelper.Equals(
                this,
                other,
                rhs => this.StatusEventArgs == rhs.StatusEventArgs &&
                this.VolumeChangedEventArgs == rhs.VolumeChangedEventArgs &&
                this.AudioOutputEventArgs == rhs.AudioOutputEventArgs));
 }
예제 #9
0
        /// <summary>
        /// Determines whether the specified <see cref="object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
        /// <returns><c>true</c> if the specified object is equal to this instance; otherwise, <c>false</c>.</returns>
        public override bool Equals(object obj)
        {
            RequestGetAcl other = obj as RequestGetAcl;

            if (other == null)
            {
                return(false);
            }

            if (!base.Equals(obj))
            {
                return(false);
            }

            return(EqualityHelper.Equals(this.Stat, other.Stat));
        }
예제 #10
0
        /// <summary>
        /// Determines whether the specified <see cref="object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="object"/> to compare with this instance.</param>
        /// <returns><c>true</c> if the specified object is equal to this instance; otherwise, <c>false</c>.</returns>
        public override bool Equals(object obj)
        {
            RequestExists other = obj as RequestExists;

            if (other == null)
            {
                return(false);
            }

            if (!base.Equals(obj))
            {
                return(false);
            }

            return(EqualityHelper.Equals(this.Watcher, other.Watcher));
        }
예제 #11
0
        /// <inheritdoc />
        public override bool DataEquals(IRingMasterBackendRequest obj)
        {
            RequestSetAcl other = obj as RequestSetAcl;

            if (other == null)
            {
                return(false);
            }

            if (!base.DataEquals(other))
            {
                return(false);
            }

            if (this.Version != other.Version)
            {
                return(false);
            }

            return(EqualityHelper.Equals(this.Acl, other.Acl));
        }
예제 #12
0
        /// <inheritdoc />
        public override bool DataEquals(IRingMasterBackendRequest obj)
        {
            RequestSetData other = obj as RequestSetData;

            if (this.Version != other?.Version)
            {
                return(false);
            }

            if (this.IsDataCommand != other.IsDataCommand)
            {
                return(false);
            }

            if (!base.DataEquals(other))
            {
                return(false);
            }

            return(EqualityHelper.Equals(this.Data, other.Data));
        }
            /// <summary>
            /// sets up the tree for commands, with the given Acls and structure
            /// </summary>
            internal void SetupCommandTree()
            {
                // instantiate a fake session with proper credentials
                ClientSession ses = this.backend.GetLoopbackSession(RMCommands.CommanderDigest);

                try
                {
                    // extract the digest from Auth, and build Acls
                    string[] digestieces = ses.Auth.ClientDigest.Split(':');

                    List <Acl> acls = null;
                    if (digestieces.Length == 2)
                    {
                        acls = new List <Acl>()
                        {
                            new Acl((int)Perm.ALL, new Id(digestieces[0], digestieces[1]))
                        };
                    }

                    // now, build the tree
                    RequestResponse resp;

                    // try to create the path to the commands node, with the Acls
                    resp = this.backend.ProcessMessage(new RequestCreate(this.backend.ReplicaCommandPathPrefix, null, null, acls, CreateMode.PersistentAllowPathCreation, null), ses);
                    Trace.TraceInformation("SetupCommandTree: create({0})-->{1}", this.backend.ReplicaCommandPathPrefix, (Code)resp.ResultCode);

                    bool needsAcl = true;

                    // try to override the ACls, in case those were wrong
                    Stat anyStat = new Stat();
                    anyStat.Aversion = anyStat.Cversion = anyStat.Version = -1;
                    resp             = this.backend.ProcessMessage(new RequestGetAcl(this.backend.ReplicaCommandPathPrefix, null, anyStat, null), ses);

                    if (resp != null && resp.ResultCode == (int)Code.Ok)
                    {
                        IList <Acl> prevAcl = resp.Content as IList <Acl>;

                        if (EqualityHelper.Equals(acls, prevAcl))
                        {
                            needsAcl = false;
                        }
                    }

                    if (needsAcl)
                    {
                        // try to override the ACls, in case those were wrong
                        resp = this.backend.ProcessMessage(new RequestSetAcl(this.backend.ReplicaCommandPathPrefix, null, acls, -1, null), ses);
                        Trace.TraceInformation("SetupCommandTree: setacl({0})-->{1}", this.backend.ReplicaCommandPathPrefix, (Code)resp.ResultCode);
                    }
                    else
                    {
                        Trace.TraceInformation("SetupCommandTree: setacl({0})-->{1}", this.backend.ReplicaCommandPathPrefix, "not needed");
                    }

                    // now we add the paths we need to have
                    List <string> paths = new List <string>()
                    {
                        this.thisCommandPathPrimary,
                        this.thisCommandPathOneSecondary,
                        this.thisCommandPathAllReplicas,
                        this.thisCommandPathAllSecondaries,
                    };

                    // append the instance command nodes
                    foreach (ClusterMember m in this.backend.Factory.GetAgreedMembers())
                    {
                        paths.Add(this.backend.ReplicaCommandPathPrefix + "/$$" + m.MemberId);
                    }

                    // create the command nodes
                    foreach (string path in paths)
                    {
                        resp = this.backend.ProcessMessage(new RequestCreate(path, null, null, null, CreateMode.Persistent, null), ses);
                        Trace.TraceInformation("SetupCommandTree: create({0})-->{1}", path, (Code)resp.ResultCode);
                    }
                }
                finally
                {
                    if (ses != null)
                    {
                        ses.Close();
                    }
                }
            }
예제 #14
0
 /// <summary>
 /// Determines whether the specified object is equal to the current object
 /// </summary>
 /// <param name="obj">
 /// The object to compare with the current object
 /// </param>
 /// <returns>
 /// True if the specified object is equal to the current object; false otherwise
 /// </returns>
 public override bool Equals(object obj) => EqualityHelper.Equals(this, obj);
예제 #15
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other">other</paramref> parameter; otherwise, false.
 /// </returns>
 public bool Equals(UnixEndPoint other)
 {
     return(EqualityHelper.Equals(this, other, rhs => this.Filename == rhs.Filename));
 }
예제 #16
0
 /// <summary>
 /// Determines whether the specified <see cref="object" />, is equal to this instance.
 /// </summary>
 /// <param name="other">The <see cref="object" /> to compare with this instance.</param>
 /// <returns>
 ///   <c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 public override bool Equals(object other)
 {
     return(EqualityHelper.Equals(this, other));
 }
예제 #17
0
 /// <summary>
 /// Determines whether the specified <see cref="ConstantFlatIdentifierRepresentation" />, is equal to this instance.
 /// </summary>
 /// <param name="other">The <see cref="ConstantFlatIdentifierRepresentation" /> to compare with this instance.</param>
 /// <returns>
 ///   <c>true</c> if the specified <see cref="ConstantFlatIdentifierRepresentation" /> is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 public bool Equals(ConstantFlatIdentifierRepresentation other)
 {
     return(EqualityHelper.Equals(this, other, obj => this.Constant.Equals(obj.Constant)));
 }
예제 #18
0
 /// <summary>
 /// Determines whether the specified <see cref="IFlatIdentifierRepresentation" />, is equal to this instance.
 /// </summary>
 /// <param name="other">The <see cref="IFlatIdentifierRepresentation" /> to compare with this instance.</param>
 /// <returns>
 ///   <c>true</c> if the specified <see cref="IFlatIdentifierRepresentation" /> is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 public bool Equals(IFlatIdentifierRepresentation other)
 {
     return(EqualityHelper.Equals(this, other));
 }
예제 #19
0
 /// <summary>
 /// Determines whether the specified <see cref="object" />, is equal to this instance.
 /// </summary>
 /// <param name="obj">The <see cref="object" /> to compare with this instance.</param>
 /// <returns>
 ///   <c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 public sealed override bool Equals(object obj)
 {
     return(EqualityHelper.Equals <ITag>(this, obj));
 }
예제 #20
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other">other</paramref> parameter; otherwise, false.
 /// </returns>
 public bool Equals(ITag other)
 {
     return(EqualityHelper.Equals(this, other, rhs => this.RawData.SequenceEqual(rhs.RawData)));
 }
예제 #21
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other">other</paramref> parameter; otherwise, false.
 /// </returns>
 public bool Equals(PlaylistEntity?other)
 {
     return(EqualityHelper.Equals(this, other, rhs => Equals(this.Name, rhs.Name)));
 }
예제 #22
0
 public bool Equals(Vector?other)
 {
     return(EqualityHelper.Equals(this, other, rhs => this.X == rhs.X && this.Y == rhs.Y));
 }
예제 #23
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the
 /// same type
 /// </summary>
 /// <param name="other">
 /// An object to compare with this object
 /// </param>
 /// <returns>
 /// True if the current object is equal to the other parameter; false otherwise
 /// </returns>
 public bool Equals(Breach other) => EqualityHelper.Equals(this, other);
예제 #24
0
 public override bool Equals(object?obj)
 {
     return(EqualityHelper.Equals(this, obj));
 }
예제 #25
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the
 /// same type
 /// </summary>
 /// <param name="other">
 /// An object to compare with this object
 /// </param>
 /// <returns>
 /// True if the current object is equal to the other parameter; false otherwise
 /// </returns>
 public bool Equals(Paste other) => EqualityHelper.Equals(this, other);