Пример #1
0
        private void InitializeSnapshotStore <TAggregateSnapshot>(TIdentity aggregateId, TAggregateSnapshot aggregateSnapshot, long sequenceNumber)
            where TAggregateSnapshot : IAggregateSnapshot <TAggregate, TIdentity>
        {
            var snapshotStore     = Persistence.Instance.Apply(_testKit.Sys).SnapshotStoreFor(null);
            var committedSnapshot = new ComittedSnapshot <TAggregate, TIdentity, TAggregateSnapshot>(aggregateId, aggregateSnapshot, new SnapshotMetadata(), DateTimeOffset.UtcNow, sequenceNumber);

            var metadata = new AkkaSnapshotMetadata(aggregateId.ToString(), sequenceNumber);

            snapshotStore.Tell(new SaveSnapshot(metadata, committedSnapshot), AggregateTestProbe.Ref);

            AggregateTestProbe.ExpectMsg <SaveSnapshotSuccess>(x =>
                                                               x.Metadata.SequenceNr == sequenceNumber &&
                                                               x.Metadata.PersistenceId == aggregateId.ToString());
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectedSnapshot"/> class.
 /// </summary>
 /// <param name="metadata">Snapshot metadata.</param>
 /// <param name="snapshot">Snapshot.</param>
 public SelectedSnapshot(SnapshotMetadata metadata, object snapshot)
 {
     Metadata = metadata;
     Snapshot = snapshot;
 }
Пример #3
0
 internal bool IsMatch(SnapshotMetadata metadata)
 {
     return(metadata.SequenceNr <= MaxSequenceNr && metadata.Timestamp <= MaxTimeStamp &&
            metadata.SequenceNr >= MinSequenceNr && metadata.Timestamp >= MinTimestamp);
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SnapshotOffer"/> class.
 /// </summary>
 /// <param name="metadata">Snapshot metadata.</param>
 /// <param name="snapshot">Snapshot.</param>
 public SnapshotOffer(SnapshotMetadata metadata, object snapshot)
 {
     Metadata = metadata;
     Snapshot = snapshot;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeleteSnapshotFailure"/> class.
 /// </summary>
 /// <param name="metadata">Snapshot metadata.</param>
 /// <param name="cause">A failure cause.</param>
 public DeleteSnapshotFailure(SnapshotMetadata metadata, Exception cause)
 {
     Metadata = metadata;
     Cause    = cause;
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeleteSnapshotSuccess"/> class.
 /// </summary>
 /// <param name="metadata">Snapshot metadata.</param>
 public DeleteSnapshotSuccess(SnapshotMetadata metadata)
 {
     Metadata = metadata;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SaveSnapshotSuccess"/> class.
 /// </summary>
 /// <param name="metadata">Snapshot metadata.</param>
 public SaveSnapshotSuccess(SnapshotMetadata metadata)
 {
     Metadata = metadata;
 }
Пример #8
0
 public DeleteSnapshot(SnapshotMetadata metadata)
 {
     Metadata = metadata;
 }
Пример #9
0
 public SaveSnapshot(SnapshotMetadata metadata, object snapshot)
 {
     Metadata = metadata;
     Snapshot = snapshot;
 }