Couchbase.ObserveHandler.isInExpectedState C# (CSharp) Method

isInExpectedState() private method

private isInExpectedState ( int replicaFoundCount, int replicaPersistedCount, bool masterPersisted ) : bool
replicaFoundCount int
replicaPersistedCount int
masterPersisted bool
return bool
        private bool isInExpectedState(int replicaFoundCount, int replicaPersistedCount, bool masterPersisted)
        {
            var persistedTo = (int)_settings.PersistTo;
            var replicateTo = (int)_settings.ReplicateTo;

            var isExpectedReplication = (replicaFoundCount >= replicateTo || replicaPersistedCount >= replicateTo);
            var isExpectedReplicationPersistence = (replicaPersistedCount >= persistedTo-1); //don't count master
            var isExpectedMasterPersistence = _settings.PersistTo == PersistTo.Zero || ((persistedTo >= 1) && masterPersisted);

            if (log.IsDebugEnabled) log.Debug("Expected Replication: " + isExpectedReplication + ", Expected Persistence: " + isExpectedReplicationPersistence + ", Expected Master Persistence: " + isExpectedMasterPersistence);

            return isExpectedReplication && isExpectedReplicationPersistence && isExpectedMasterPersistence;
        }