示例#1
0
        public void SnapshotStore_should_not_load_a_snapshot_given_non_matching_sequence_number_criteria()
        {
            SnapshotStore.Tell(
                new LoadSnapshot(Pid, new SnapshotSelectionCriteria(7L), long.MaxValue),
                _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
            {
                if (result.Snapshot == null)
                {
                    return(result.ToSequenceNr == long.MaxValue);
                }
                return(false);
            }, new TimeSpan?());

            SnapshotStore.Tell(new LoadSnapshot(Pid, SnapshotSelectionCriteria.Latest, 7L),
                               _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
            {
                if (result.Snapshot == null)
                {
                    return(result.ToSequenceNr == 7L);
                }
                return(false);
            }, new TimeSpan?());
        }
示例#2
0
        public void ShouldSerializeSnapshots()
        {
            if (!SupportsSerialization)
            {
                return;
            }

            var probe    = CreateTestProbe();
            var metadata = new SnapshotMetadata(Pid, 100L);
            var snap     = new TestPayload(probe.Ref);

            SnapshotStore.Tell(new SaveSnapshot(metadata, snap), _senderProbe.Ref);
            _senderProbe.ExpectMsg <SaveSnapshotSuccess>(o =>
            {
                Assertions.AssertEqual(metadata.PersistenceId, o.Metadata.PersistenceId);
                Assertions.AssertEqual(metadata.SequenceNr, o.Metadata.SequenceNr);
            });

            var pid = Pid;

            SnapshotStore.Tell(new LoadSnapshot(pid, SnapshotSelectionCriteria.Latest, long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(l =>
            {
                Assertions.AssertEqual(pid, l.Snapshot.Metadata.PersistenceId);
                Assertions.AssertEqual(100L, l.Snapshot.Metadata.SequenceNr);
                Assertions.AssertEqual(l.Snapshot.Snapshot, snap);
            });
        }
示例#3
0
        public void SnapshotStore_should_delete_a_single_snapshot_identified_by_SequenceNr_in_snapshot_metadata()
        {
            var snapshotMetadata = _metadata[2];
            var metadata         =
                new SnapshotMetadata(snapshotMetadata.PersistenceId, snapshotMetadata.SequenceNr);
            var message   = new DeleteSnapshot(metadata);
            var testProbe = CreateTestProbe();

            Subscribe <DeleteSnapshot>(testProbe.Ref);
            SnapshotStore.Tell(message, _senderProbe.Ref);
            testProbe.ExpectMsg(message, new TimeSpan?());
            _senderProbe.ExpectMsg <DeleteSnapshotSuccess>(new TimeSpan?());
            SnapshotStore.Tell(
                new LoadSnapshot(Pid, new SnapshotSelectionCriteria(metadata.SequenceNr),
                                 long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg((Predicate <LoadSnapshotResult>)(result =>
            {
                if (result.ToSequenceNr == long.MaxValue && result.Snapshot != null &&
                    result.Snapshot.Metadata.Equals(_metadata[1]))
                {
                    return(result.Snapshot.Snapshot.ToString() == "s-2");
                }
                return(false);
            }), new TimeSpan?());
        }
示例#4
0
        public void SnapshotStore_should_not_delete_snapshots_with_non_matching_upper_timestamp_bounds()
        {
            var snapshotMetadata = _metadata[3];
            var criteria         = new SnapshotSelectionCriteria(snapshotMetadata.SequenceNr,
                                                                 snapshotMetadata.Timestamp.Subtract(TimeSpan.FromTicks(1L)), 0L, new DateTime?());
            var message   = new DeleteSnapshots(Pid, criteria);
            var testProbe = CreateTestProbe();

            Subscribe <DeleteSnapshots>(testProbe.Ref);
            SnapshotStore.Tell(message, _senderProbe.Ref);
            testProbe.ExpectMsg(message, new TimeSpan?());
            _senderProbe.ExpectMsg <DeleteSnapshotsSuccess>(m => m.Criteria.Equals(criteria), new TimeSpan?());
            SnapshotStore.Tell(
                new LoadSnapshot(Pid,
                                 new SnapshotSelectionCriteria(snapshotMetadata.SequenceNr, snapshotMetadata.Timestamp, 0L,
                                                               new DateTime?()), long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg((Predicate <LoadSnapshotResult>)(result =>
            {
                if (result.ToSequenceNr == long.MaxValue && result.Snapshot != null &&
                    result.Snapshot.Metadata.Equals(_metadata[3]))
                {
                    return(result.Snapshot.Snapshot.ToString() == "s-4");
                }
                return(false);
            }), new TimeSpan?());
        }
示例#5
0
 public void SnapshotStore_should_load_the_most_recent_snapshot_matching_an_upper_sequence_number_bound()
 {
     SnapshotStore.Tell(
         new LoadSnapshot(Pid, new SnapshotSelectionCriteria(13L), long.MaxValue), _senderProbe.Ref
         );
     _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
     {
         if (result.ToSequenceNr == long.MaxValue && result.Snapshot != null &&
             result.Snapshot.Metadata.Equals(_metadata[2]))
         {
             return(result.Snapshot.Snapshot.ToString() == "s-3");
         }
         return(false);
     }, new TimeSpan?());
     SnapshotStore.Tell(new LoadSnapshot(Pid, SnapshotSelectionCriteria.Latest, 13L),
                        _senderProbe.Ref);
     _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
     {
         if (result.ToSequenceNr == 13L && result.Snapshot != null &&
             result.Snapshot.Metadata.Equals(_metadata[2]))
         {
             return(result.Snapshot.Snapshot.ToString() == "s-3");
         }
         return(false);
     }, new TimeSpan?());
 }
示例#6
0
        SnapshotStore_should_load_the_most_recent_snapshot_matching_an_upper_sequence_number_and_timestamp_bound()
        {
            SnapshotStore.Tell(
                new LoadSnapshot(Pid,
                                 new SnapshotSelectionCriteria(13L, _metadata[2].Timestamp, 0L, new DateTime?()),
                                 long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
            {
                var isMaxSeqNo      = result.ToSequenceNr == long.MaxValue;
                var snapshotNotNull = result.Snapshot != null;
                var matchMetadata   = result.Snapshot.Metadata.Equals(_metadata[2]);
                if (isMaxSeqNo && snapshotNotNull && matchMetadata)
                {
                    return(result.Snapshot.Snapshot.ToString() == "s-3");
                }
                return(false);
            }, new TimeSpan?());

            SnapshotStore.Tell(
                new LoadSnapshot(Pid,
                                 new SnapshotSelectionCriteria(long.MaxValue, _metadata[2].Timestamp, 0L, new DateTime?()),
                                 13L), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
            {
                var isMaxSeqNo      = result.ToSequenceNr == 13L;
                var snapshotNotNull = result.Snapshot != null;
                var matchMetadata   = result.Snapshot.Metadata.Equals(_metadata[2]);
                if (isMaxSeqNo && snapshotNotNull && matchMetadata)
                {
                    return(result.Snapshot.Snapshot.ToString() == "s-3");
                }
                return(false);
            }, new TimeSpan?());
        }
示例#7
0
        public void SnapshotStore_should_not_load_a_snapshot_given_non_matching_sequence_number_criteria()
        {
            SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(7), long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result => result.Snapshot == null && result.ToSequenceNr == long.MaxValue);

            SnapshotStore.Tell(new LoadSnapshot(Pid, SnapshotSelectionCriteria.Latest, 7), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result => result.Snapshot == null && result.ToSequenceNr == 7);
        }
示例#8
0
 public void SnapshotStore_should_load_the_most_recent_snapshot()
 {
     SnapshotStore.Tell(new LoadSnapshot(Pid, SnapshotSelectionCriteria.Latest, long.MaxValue), _senderProbe.Ref);
     _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
                                                 result.ToSequenceNr == long.MaxValue &&
                                                 result.Snapshot != null &&
                                                 result.Snapshot.Metadata.Equals(Metadata[4]) &&
                                                 result.Snapshot.Snapshot.ToString() == "s-5");
 }
示例#9
0
 private IEnumerable <SnapshotMetadata> WriteSnapshots()
 {
     for (int i = 1; i <= 5; i++)
     {
         var metadata = new SnapshotMetadata(Pid, i + 10);
         SnapshotStore.Tell(new SaveSnapshot(metadata, $"s-{i}"), _senderProbe.Ref);
         yield return(_senderProbe.ExpectMsg <SaveSnapshotSuccess>().Metadata);
     }
 }
示例#10
0
        public void SnapshotStore_should_save_bigger_size_snapshot()
        {
            var metadata    = new SnapshotMetadata(Pid, 100);
            var bigSnapshot = new byte[SnapshotByteSizeLimit];

            new Random().NextBytes(bigSnapshot);
            SnapshotStore.Tell(new SaveSnapshot(metadata, bigSnapshot), _senderProbe.Ref);
            _senderProbe.ExpectMsg <SaveSnapshotSuccess>();
        }
示例#11
0
 public void SnapshotStore_should_not_load_a_snapshot_given_an_invalid_persistence_id()
 {
     SnapshotStore.Tell(
         new LoadSnapshot("invalid", SnapshotSelectionCriteria.Latest, long.MaxValue),
         _senderProbe.Ref
         );
     _senderProbe.ExpectMsg <LoadSnapshotResult>(
         result => result.Snapshot == null && result.ToSequenceNr == long.MaxValue, new TimeSpan?());
 }
示例#12
0
        public void SnapshotStore_should_not_load_a_snapshot_given_non_matching_timestamp_criteria()
        {
            var criteria = new SnapshotSelectionCriteria(
                long.MaxValue,
                new DateTime(100000L),
                0L,
                new DateTime?()
                );

            SnapshotStore.Tell(new LoadSnapshot(Pid, criteria, long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(
                result => result.Snapshot == null && result.ToSequenceNr == long.MaxValue, new TimeSpan?());
        }
        public void LocalSnapshotStore_can_snapshot_actors_with_PersistenceId_containing_invalid_path_characters()
        {
            var pid = @"p\/:*?-1";

            SnapshotStore.Tell(new SaveSnapshot(new SnapshotMetadata(pid, 1), "sample data"), TestActor);
            ExpectMsg <SaveSnapshotSuccess>();

            SnapshotStore.Tell(new LoadSnapshot(pid, SnapshotSelectionCriteria.Latest, long.MaxValue), TestActor);
            ExpectMsg <LoadSnapshotResult>(res =>
                                           res.Snapshot.Snapshot.Equals("sample data") &&
                                           res.Snapshot.Metadata.PersistenceId == pid &&
                                           res.Snapshot.Metadata.SequenceNr == 1);
        }
示例#14
0
        public void SnapshotStore_should_save_and_overwrite_snapshot_with_same_sequence_number()
        {
            var md = Metadata[4];

            SnapshotStore.Tell(new SaveSnapshot(md, "s-5-modified"), _senderProbe.Ref);
            var md2 = _senderProbe.ExpectMsg <SaveSnapshotSuccess>().Metadata;

            Assert.Equal(md.SequenceNr, md2.SequenceNr);
            SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(md.SequenceNr), long.MaxValue), _senderProbe.Ref);
            var result = _senderProbe.ExpectMsg <LoadSnapshotResult>();

            Assert.Equal("s-5-modified", result.Snapshot.Snapshot.ToString());
            Assert.Equal(md.SequenceNr, result.Snapshot.Metadata.SequenceNr);
            // metadata timestamp may have been changed
        }
示例#15
0
        public void SnapshotStore_should_load_the_most_recent_snapshot_matching_an_upper_sequence_number_and_timestamp_bound()
        {
            SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(13, Metadata[2].Timestamp), long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
                                                        result.ToSequenceNr == long.MaxValue &&
                                                        result.Snapshot != null &&
                                                        result.Snapshot.Metadata.Equals(Metadata[2]) &&
                                                        result.Snapshot.Snapshot.ToString() == "s-3");

            SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(long.MaxValue, Metadata[2].Timestamp), 13), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
                                                        result.ToSequenceNr == 13 &&
                                                        result.Snapshot != null &&
                                                        result.Snapshot.Metadata.Equals(Metadata[2]) &&
                                                        result.Snapshot.Snapshot.ToString() == "s-3");
        }
示例#16
0
        protected IActorRef WriteSnapshot(string persistenceId, int n)
        {
            var pref = Sys.ActorOf(Query.TestActor.Props(persistenceId));

            for (var i = 1; i <= n; i++)
            {
                pref.Tell($"{persistenceId}-{i}");
                ExpectMsg($"{persistenceId}-{i}-done");
            }

            var metadata = new SnapshotMetadata(persistenceId, n + 10);

            SnapshotStore.Tell(new SaveSnapshot(metadata, $"s-{n}"), _senderProbe.Ref);
            _senderProbe.ExpectMsg <SaveSnapshotSuccess>();

            return(pref);
        }
示例#17
0
        public void SnapshotStore_should_load_the_most_recent_snapshot()
        {
            var msg = new LoadSnapshot(Pid, SnapshotSelectionCriteria.Latest, long.MaxValue);

            SnapshotStore.Tell(msg, _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
            {
                var isMaxSeqNo      = result.ToSequenceNr == long.MaxValue;
                var snapshotNotNull = result.Snapshot != null;
                var matchMetadata   = result.Snapshot.Metadata.Equals(_metadata[4]);
                if (isMaxSeqNo && snapshotNotNull && matchMetadata)
                {
                    return(result.Snapshot.Snapshot.ToString() == "s-5");
                }
                return(false);
            }, new TimeSpan?());
        }
示例#18
0
        public void SnapshotStore_should_not_delete_snapshots_with_non_matching_upper_timestamp_bounds()
        {
            var md       = Metadata[3];
            var criteria = new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp.Subtract(TimeSpan.FromTicks(1)));
            var command  = new DeleteSnapshots(Pid, criteria);
            var sub      = CreateTestProbe();

            Subscribe <DeleteSnapshots>(sub.Ref);
            SnapshotStore.Tell(command, _senderProbe.Ref);
            sub.ExpectMsg(command);
            _senderProbe.ExpectMsg <DeleteSnapshotsSuccess>(m => m.Criteria.Equals(criteria));

            SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp), long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
                                                        result.ToSequenceNr == long.MaxValue &&
                                                        result.Snapshot != null &&
                                                        result.Snapshot.Metadata.Equals(Metadata[3]) &&
                                                        result.Snapshot.Snapshot.ToString() == "s-4");
        }
示例#19
0
        public void SnapshotStore_should_save_and_overwrite_snapshot_with_same_sequence_number()
        {
            var metadata1 = _metadata[4];

            SnapshotStore.Tell(new SaveSnapshot(metadata1, "s-5-modified"),
                               _senderProbe.Ref);
            var metadata2 =
                _senderProbe.ExpectMsg <SaveSnapshotSuccess>(new TimeSpan?()).Metadata;

            Assert.Equal(metadata1.SequenceNr, metadata2.SequenceNr);
            SnapshotStore.Tell(
                new LoadSnapshot(Pid, new SnapshotSelectionCriteria(metadata1.SequenceNr),
                                 long.MaxValue), _senderProbe.Ref);
            var loadSnapshotResult =
                _senderProbe.ExpectMsg <LoadSnapshotResult>(new TimeSpan?());

            Assert.Equal("s-5-modified", loadSnapshotResult.Snapshot.Snapshot.ToString());
            Assert.Equal(metadata1.SequenceNr, loadSnapshotResult.Snapshot.Metadata.SequenceNr);
        }
示例#20
0
        public void SnapshotStore_should_delete_a_single_snapshot_identified_by_SequenceNr_in_snapshot_metadata()
        {
            var md = Metadata[2];

            md = new SnapshotMetadata(md.PersistenceId, md.SequenceNr); // don't care about timestamp for delete of a single snap
            var command = new DeleteSnapshot(md);
            var sub     = CreateTestProbe();

            Subscribe <DeleteSnapshot>(sub.Ref);
            SnapshotStore.Tell(command, _senderProbe.Ref);
            sub.ExpectMsg(command);
            _senderProbe.ExpectMsg <DeleteSnapshotSuccess>();

            SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(md.SequenceNr), long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
                                                        result.ToSequenceNr == long.MaxValue &&
                                                        result.Snapshot != null &&
                                                        result.Snapshot.Metadata.Equals(Metadata[1]) &&
                                                        result.Snapshot.Snapshot.ToString() == "s-2");
        }
        protected Task <SnapshotMetadata> SaveSnapshotTaskAsync(object snapshot)
        {
            if (_saveSnapshotTcsMap == null)
            {
                _saveSnapshotTcsMap = new Dictionary <long, TaskCompletionSource <SnapshotMetadata> >();
            }

            var metadata = new SnapshotMetadata(SnapshotterId, SnapshotSequenceNr);

            if (_saveSnapshotTcsMap.ContainsKey(SnapshotSequenceNr))
            {
                return(Task.FromResult(metadata));
            }

            var tcs = new TaskCompletionSource <SnapshotMetadata>();

            _saveSnapshotTcsMap.Add(SnapshotSequenceNr, tcs);

            SnapshotStore.Tell(new SaveSnapshot(metadata, snapshot), Self);
            return(tcs.Task);
        }
示例#22
0
        public void SnapshotStore_should_delete_all_snapshots_matching_upper_sequence_number_and_timestamp_bounds()
        {
            var snapshotMetadata = _metadata[2];
            var message          = new DeleteSnapshots(Pid,
                                                       new SnapshotSelectionCriteria(snapshotMetadata.SequenceNr, snapshotMetadata.Timestamp, 0L,
                                                                                     new DateTime?()));
            var testProbe = CreateTestProbe();

            Subscribe <DeleteSnapshots>(testProbe.Ref);
            SnapshotStore.Tell(message, _senderProbe.Ref);
            testProbe.ExpectMsg(message, new TimeSpan?());
            _senderProbe.ExpectMsg <DeleteSnapshotsSuccess>(new TimeSpan?());

            SnapshotStore.Tell(
                new LoadSnapshot(Pid,
                                 new SnapshotSelectionCriteria(snapshotMetadata.SequenceNr, snapshotMetadata.Timestamp, 0L,
                                                               new DateTime?()), long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
            {
                if (result.Snapshot == null)
                {
                    return(result.ToSequenceNr == long.MaxValue);
                }
                return(false);
            }, new TimeSpan?());

            SnapshotStore.Tell(
                new LoadSnapshot(Pid,
                                 new SnapshotSelectionCriteria(_metadata[3].SequenceNr, _metadata[3].Timestamp, 0L,
                                                               new DateTime?()), long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
            {
                if (result.ToSequenceNr == long.MaxValue && result.Snapshot != null &&
                    result.Snapshot.Metadata.Equals(_metadata[3]))
                {
                    return(result.Snapshot.Snapshot.ToString() == "s-4");
                }
                return(false);
            }, new TimeSpan?());
        }
示例#23
0
        public void SnapshotStore_should_delete_all_snapshots_matching_upper_sequence_number_and_timestamp_bounds()
        {
            var md      = Metadata[2];
            var command = new DeleteSnapshots(Pid, new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp));
            var sub     = CreateTestProbe();

            Subscribe <DeleteSnapshots>(sub.Ref);
            SnapshotStore.Tell(command, _senderProbe.Ref);
            sub.ExpectMsg(command);
            _senderProbe.ExpectMsg <DeleteSnapshotsSuccess>();

            SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(md.SequenceNr, md.Timestamp), long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result => result.Snapshot == null && result.ToSequenceNr == long.MaxValue);


            SnapshotStore.Tell(new LoadSnapshot(Pid, new SnapshotSelectionCriteria(Metadata[3].SequenceNr, Metadata[3].Timestamp), long.MaxValue), _senderProbe.Ref);
            _senderProbe.ExpectMsg <LoadSnapshotResult>(result =>
                                                        result.ToSequenceNr == long.MaxValue &&
                                                        result.Snapshot != null &&
                                                        result.Snapshot.Metadata.Equals(Metadata[3]) &&
                                                        result.Snapshot.Snapshot.ToString() == "s-4");
        }
        public void SnapshotStore_should_serialize_with_transport_if_enabled()
        {
            //Given
            var ser      = Sys.Serialization.FindSerializerForType(typeof(ActorRefWrapper));
            var receiver = CreateTestProbe();
            var myEvent  = new ActorRefWrapper
            {
                ActorRef = CreateTestActor("test-actor")
            };

            //When
            var metadata = new SnapshotMetadata(Pid, 0);

            SnapshotStore.Tell(new SaveSnapshot(metadata, myEvent), receiver.Ref);
            receiver.ExpectMsg <SaveSnapshotSuccess>();
            SnapshotStore.Tell(new LoadSnapshot(Pid, SnapshotSelectionCriteria.Latest, 1), receiver.Ref);

            //Then
            receiver.ExpectMsg <LoadSnapshotResult>(msg =>
            {
                var e = (ActorRefWrapper)msg.Snapshot.Snapshot;
                Assert.True(e.IsSerializedWithTransport, "snapshot should be serialized with transport");
            });
        }
 /// <summary>
 /// Deletes all snapshots matching <paramref name="criteria"/>.
 ///
 /// The <see cref="PersistentActor"/> will be notified about the status of the deletion
 /// via an <see cref="DeleteSnapshotsSuccess"/> or <see cref="DeleteSnapshotsFailure"/> message.
 /// </summary>
 public void DeleteSnapshots(SnapshotSelectionCriteria criteria)
 {
     SnapshotStore.Tell(new DeleteSnapshots(SnapshotterId, criteria));
 }
 /// <summary>
 /// Deletes the snapshot identified by <paramref name="sequenceNr"/>.
 ///
 /// The <see cref="PersistentActor"/> will be notified about the status of the deletion
 /// via an <see cref="DeleteSnapshotSuccess"/> or <see cref="DeleteSnapshotFailure"/> message.
 /// </summary>
 public void DeleteSnapshot(long sequenceNr)
 {
     SnapshotStore.Tell(new DeleteSnapshot(new SnapshotMetadata(SnapshotterId, sequenceNr)));
 }
 /// <summary>
 /// Saves <paramref name="snapshot"/> of current <see cref="ISnapshotter"/> state.
 ///
 /// The <see cref="PersistentActor"/> will be notified about the success or failure of this
 /// via an <see cref="SaveSnapshotSuccess"/> or <see cref="SaveSnapshotFailure"/> message.
 /// </summary>
 public void SaveSnapshot(object snapshot)
 {
     SnapshotStore.Tell(new SaveSnapshot(new SnapshotMetadata(SnapshotterId, SnapshotSequenceNr), snapshot));
 }
 /// <summary>
 /// Instructs the snapshot store to load the specified snapshot and send it via an
 /// <see cref="SnapshotOffer"/> to the running <see cref="PersistentActor"/>.
 /// </summary>
 public void LoadSnapshot(string persistenceId, SnapshotSelectionCriteria criteria, long toSequenceNr)
 {
     SnapshotStore.Tell(new LoadSnapshot(persistenceId, criteria, toSequenceNr));
 }
示例#29
0
 public void DeleteSnapshot(long sequenceNr, DateTime timestamp)
 {
     SnapshotStore.Tell(new DeleteSnapshot(new SnapshotMetadata(SnapshotterId, sequenceNr, timestamp)));
 }