public OptimisticEventStream(Snapshot snapshot, ICommitEvents persistence, int maxRevision)
     : this(snapshot.StreamId, persistence)
 {
     IEnumerable<Commit> commits = persistence.GetFrom(snapshot.StreamId, snapshot.StreamRevision, maxRevision);
     PopulateStream(snapshot.StreamRevision + 1, maxRevision, commits);
     StreamRevision = snapshot.StreamRevision + _committed.Count;
 }
Ejemplo n.º 2
0
 public OptimisticEventStream(Snapshot snapshot, ICommitEvents persistence, int maxRevision)
     : this(snapshot.StreamId, persistence)
 {
     var commits = persistence.GetFrom(snapshot.StreamId, snapshot.StreamRevision, maxRevision);
     this.PopulateStream(snapshot.StreamRevision + 1, maxRevision, commits);
     this.StreamRevision = snapshot.StreamRevision + this.committed.Count;
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     Gets the corresponding commits from the stream indicated starting at the revision specified until the
 ///     end of the stream sorted in ascending order--from oldest to newest from the default bucket.
 /// </summary>
 /// <param name="commitEvents">The <see cref="ICommitEvents"/> instance.</param>
 /// <param name="streamId">The stream from which the events will be read.</param>
 /// <param name="minRevision">The minimum revision of the stream to be read.</param>
 /// <param name="maxRevision">The maximum revision of the stream to be read.</param>
 /// <returns>A series of committed events from the stream specified sorted in ascending order.</returns>
 /// <exception cref="StorageException" />
 /// <exception cref="StorageUnavailableException" />
 public static IEnumerable <Commit> GetFrom(this ICommitEvents commitEvents, string streamId, int minRevision, int maxRevision)
 {
     if (commitEvents == null)
     {
         throw new ArgumentException("commitEvents is null");
     }
     return(commitEvents.GetFrom(Bucket.Default, streamId, minRevision, maxRevision));
 }
Ejemplo n.º 4
0
        public OptimisticEventStream(Snapshot snapshot, ICommitEvents persistence, int maxRevision)
            : this(snapshot.StreamId, persistence)
        {
            var commits = persistence.GetFrom(snapshot.StreamId, snapshot.StreamRevision, maxRevision);

            this.PopulateStream(snapshot.StreamRevision + 1, maxRevision, commits);
            this.StreamRevision = snapshot.StreamRevision + this.committed.Count;
        }
Ejemplo n.º 5
0
        public OptimisticEventStream(ISnapshot snapshot, ICommitEvents persistence, int maxRevision)
            : this(snapshot.BucketId, snapshot.StreamId, persistence)
        {
            IEnumerable <ICommit> commits = persistence.GetFrom(snapshot.BucketId, snapshot.StreamId, snapshot.StreamRevision, maxRevision);

            PopulateStream(snapshot.StreamRevision + 1, maxRevision, commits);
            StreamRevision = snapshot.StreamRevision + _committed.Count;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the corresponding commits from the stream indicated starting at the revision specified until the
        /// end of the stream sorted in ascending order--from oldest to newest from the default bucket.
        /// </summary>
        /// <param name="commitEvents">The <see cref="ICommitEvents"/> instance.</param>
        /// <param name="streamId">The stream from which the events will be read.</param>
        /// <param name="minRevision">The minimum revision of the stream to be read.</param>
        /// <param name="maxRevision">The maximum revision of the stream to be read.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>A series of committed events from the stream specified sorted in ascending order.</returns>
        /// <exception cref="StorageException" />
        /// <exception cref="StorageUnavailableException" />
        public static Task <IEnumerable <ICommit> > GetFromAsync(this ICommitEvents commitEvents, string streamId, int minRevision, int maxRevision, CancellationToken cancellationToken)
        {
            if (commitEvents == null)
            {
                throw new ArgumentNullException(nameof(commitEvents));
            }

            return(commitEvents.GetFromAsync(Bucket.Default, streamId, minRevision, maxRevision, cancellationToken));
        }
Ejemplo n.º 7
0
        public OptimisticEventStream(Guid streamId, ICommitEvents persistence, int minRevision, int maxRevision)
            : this(streamId, persistence)
        {
            var commits = persistence.GetFrom(streamId, minRevision, maxRevision);
            this.PopulateStream(minRevision, maxRevision, commits);

            if (minRevision > 0 && this.committed.Count == 0)
                throw new StreamNotFoundException();
        }
Ejemplo n.º 8
0
        public OptimisticEventStream(ISnapshot snapshot, ICommitEvents persistence, int maxRevision, CancellationToken cancellationToken)
            : this(snapshot.BucketId, snapshot.StreamId, persistence)
        {
            var commits = persistence
                          .GetFromAsync(snapshot.BucketId, snapshot.StreamId, snapshot.StreamRevision, maxRevision, cancellationToken)
                          .GetAwaiter().GetResult();

            PopulateStream(snapshot.StreamRevision + 1, maxRevision, commits);
            StreamRevision = snapshot.StreamRevision + _committed.Count;
        }
 public EventStreamController(
     IStoreEvents eventStore, 
     ICommitEnhancer enhancer,
     IHandleMapper handleMapper,
     IIdentityConverter identityConverter)
 {
     _enhancer = enhancer;
     _commits = (ICommitEvents)eventStore;
     _handleMapper = handleMapper;
     _identityConverter = identityConverter;
 }
        public OptimisticEventStream(string bucketId, string streamId, ICommitEvents persistence, int minRevision, int maxRevision)
            : this(bucketId, streamId, persistence)
        {
            IEnumerable<ICommit> commits = persistence.GetFrom(bucketId, streamId, minRevision, maxRevision);
            PopulateStream(minRevision, maxRevision, commits);

            if (minRevision > 0 && _committed.Count == 0)
            {
                throw new StreamNotFoundException();
            }
        }
Ejemplo n.º 11
0
 public EventStreamController(
     IStoreEvents eventStore,
     ICommitEnhancer enhancer,
     IHandleMapper handleMapper,
     IIdentityConverter identityConverter)
 {
     _enhancer          = enhancer;
     _commits           = (ICommitEvents)eventStore;
     _handleMapper      = handleMapper;
     _identityConverter = identityConverter;
 }
Ejemplo n.º 12
0
        public OptimisticEventStream(Guid streamId, ICommitEvents persistence, int minRevision, int maxRevision)
            : this(streamId, persistence)
        {
            var commits = persistence.GetFrom(streamId, minRevision, maxRevision);

            this.PopulateStream(minRevision, maxRevision, commits);

            if (minRevision > 0 && this.committed.Count == 0)
            {
                throw new StreamNotFoundException();
            }
        }
Ejemplo n.º 13
0
        public OptimisticEventStream(string bucketId, string streamId, ICommitEvents persistence, int minRevision, int maxRevision)
            : this(bucketId, streamId, persistence)
        {
            IEnumerable <ICommit> commits = persistence.GetFrom(bucketId, streamId, minRevision, maxRevision);

            PopulateStream(minRevision, maxRevision, commits);

            if (minRevision > 0 && _committed.Count == 0)
            {
                throw new StreamNotFoundException();
            }
        }
Ejemplo n.º 14
0
 public OptimisticEventStream(
     string bucketId,
     string streamId,
     ICommitEvents persistence,
     ISystemTimeProvider systemTypeProvider
     )
 {
     BucketId            = bucketId;
     StreamId            = streamId;
     _persistence        = persistence;
     _systemTypeProvider = systemTypeProvider;
 }
        public OptimisticEventStream(
            string bucketId, 
            string streamId, 
            ICommitEvents persistence,
            ISystemTimeProvider systemTypeProvider
        )
		{
			BucketId = bucketId;
			StreamId = streamId;
			_persistence = persistence;
            _systemTypeProvider = systemTypeProvider;

        }
Ejemplo n.º 16
0
        public OptimisticEventStream(string bucketId, string streamId, ICommitEvents persistence, int minRevision, int maxRevision, CancellationToken cancellationToken)
            : this(bucketId, streamId, persistence)
        {
            var commits = persistence
                          .GetFromAsync(bucketId, streamId, minRevision, maxRevision, cancellationToken)
                          .GetAwaiter().GetResult();

            PopulateStream(minRevision, maxRevision, commits);

            if (minRevision > 0 && _committed.Count == 0)
            {
                throw new StreamNotFoundException(String.Format(Messages.StreamNotFoundException, streamId, BucketId));
            }
        }
Ejemplo n.º 17
0
 public OptimisticEventStream(string streamId, ICommitEvents persistence)
     : this(Bucket.Default, streamId, persistence)
 {
 }
Ejemplo n.º 18
0
 public OptimisticEventStream(Guid streamId, ICommitEvents persistence)
 {
     this.StreamId    = streamId;
     this.persistence = persistence;
 }
Ejemplo n.º 19
0
 public OptimisticEventStream(Guid streamId, ICommitEvents persistence)
 {
     this.StreamId = streamId;
     this.persistence = persistence;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Writes the to-be-committed events provided to the underlying
 /// persistence mechanism.
 /// </summary>
 /// <param name="commitEvents">The <see cref="ICommitEvents"/> instance.</param>
 /// <param name="attempt">The series of events and associated metadata to be committed.</param>
 /// <exception cref="ConcurrencyException" />
 /// <exception cref="StorageException" />
 /// <exception cref="StorageUnavailableException" />
 public static Task <ICommit> CommitAsync(this ICommitEvents commitEvents, CommitAttempt attempt)
 {
     return(commitEvents.CommitAsync(attempt, CancellationToken.None));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Gets the corresponding commits from the stream indicated starting
 /// at the revision specified until the end of the stream sorted in
 /// ascending order--from oldest to newest.
 /// </summary>
 /// <param name="commitEvents">The <see cref="ICommitEvents"/> instance.</param>
 /// <param name="bucketId">The value which uniquely identifies bucket the stream belongs to.</param>
 /// <param name="streamId">The stream from which the events will be read.</param>
 /// <param name="minRevision">The minimum revision of the stream to be read.</param>
 /// <param name="maxRevision">The maximum revision of the stream to be read.</param>
 /// <returns>A series of committed events from the stream specified sorted in ascending order.</returns>
 /// <exception cref="StorageException" />
 /// <exception cref="StorageUnavailableException" />
 public static Task <IEnumerable <ICommit> > GetFromAsync(this ICommitEvents commitEvents, string bucketId, string streamId, int minRevision, int maxRevision)
 {
     return(commitEvents.GetFromAsync(bucketId, streamId, minRevision, maxRevision, CancellationToken.None));
 }
 public OptimisticEventStream(string bucketId, string streamId, ICommitEvents persistence)
 {
     BucketId = bucketId;
     StreamId = streamId;
     _persistence = persistence;
 }
Ejemplo n.º 23
0
 public OptimisticEventStream(string bucketId, string streamId, ICommitEvents persistence)
 {
     BucketId     = bucketId;
     StreamId     = streamId;
     _persistence = persistence;
 }
Ejemplo n.º 24
0
 public OptimisticEventStream(string streamId, ICommitEvents persistence, int minRevision, int maxRevision)
     : this(Bucket.Default, streamId, persistence, minRevision, maxRevision)
 {
 }