コード例 #1
0
 /// <summary>
 /// Copy write policy from another write policy.
 /// </summary>
 public WritePolicy(WritePolicy other)
     : base(other)
 {
     this.recordExistsAction = other.recordExistsAction;
     this.generationPolicy   = other.generationPolicy;
     this.commitLevel        = other.commitLevel;
     this.generation         = other.generation;
     this.expiration         = other.expiration;
 }
コード例 #2
0
 /// <summary>
 /// Copy write policy from another write policy.
 /// </summary>
 public WritePolicy(WritePolicy other)
     : base(other)
 {
     this.recordExistsAction = other.recordExistsAction;
     this.generationPolicy = other.generationPolicy;
     this.commitLevel = other.commitLevel;
     this.generation = other.generation;
     this.expiration = other.expiration;
 }
コード例 #3
0
 /// <summary>
 /// Copy write policy from another write policy.
 /// </summary>
 public WritePolicy(WritePolicy other)
     : base(other)
 {
     this.recordExistsAction = other.recordExistsAction;
     this.generationPolicy   = other.generationPolicy;
     this.commitLevel        = other.commitLevel;
     this.generation         = other.generation;
     this.expiration         = other.expiration;
     this.respondAllOps      = other.respondAllOps;
     this.durableDelete      = other.durableDelete;
 }
コード例 #4
0
ファイル: CommitSource.cs プロジェクト: zerox981/EventStore
        public void NotifyFor(long position, Action target, CommitLevel level = CommitLevel.Indexed)
        {
            long currentPosition;
            ConcurrentDictionary <long, List <Action> > notificationDictionary;

            switch (level)
            {
            case CommitLevel.Replicated:
                currentPosition        = Interlocked.Read(ref _replicatedPosition);
                notificationDictionary = _notifyReplicated;
                break;

            case CommitLevel.Indexed:
                currentPosition        = Interlocked.Read(ref _indexedPosition);
                notificationDictionary = _notifyIndexed;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(level), level, null);
            }
            if (currentPosition >= position)
            {
                target();
            }
            if (!notificationDictionary.TryGetValue(position, out var actionList))
            {
                actionList = new List <Action> {
                    target
                };
                notificationDictionary.TryAdd(position, actionList);
            }
            else
            {
                lock (actionList) {
                    actionList.Add(target);
                }
            }
        }