Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using Cqrs.Domain;
11 :
12 : namespace Cqrs.Snapshots
13 : {
14 : /// <summary>
15 : /// Stores the most recent <see cref="Snapshot">snapshots</see> for replay and <see cref="IAggregateRoot{TAuthenticationToken}"/> rehydration on a <see cref="SnapshotAggregateRoot{TAuthenticationToken,TSnapshot}"/>.
16 : /// </summary>
17 : public interface ISnapshotStore
18 : {
19 : /// <summary>
20 : /// Get the latest <see cref="Snapshot"/> from storage.
21 : /// </summary>
22 : /// <typeparam name="TAggregateRoot">The <see cref="Type"/> of <see cref="IAggregateRoot{TAuthenticationToken}"/> to find a snapshot for.</typeparam>
23 : /// <param name="id">The identifier of the <see cref="IAggregateRoot{TAuthenticationToken}"/> to get the most recent <see cref="Snapshot"/> of.</param>
24 : /// <returns>The most recent <see cref="Snapshot"/> of</returns>
25 1 : Snapshot Get<TAggregateRoot>(Guid id);
26 :
27 : /// <summary>
28 : /// Get the latest <see cref="Snapshot"/> from storage.
29 : /// </summary>
30 : /// <param name="aggregateRootType">The <see cref="Type"/> of <see cref="IAggregateRoot{TAuthenticationToken}"/> to find a snapshot for.</param>
31 : /// <param name="id">The identifier of the <see cref="IAggregateRoot{TAuthenticationToken}"/> to get the most recent <see cref="Snapshot"/> of.</param>
32 : /// <returns>The most recent <see cref="Snapshot"/> of</returns>
33 1 : Snapshot Get(Type aggregateRootType, Guid id);
34 :
35 : /// <summary>
36 : /// Saves the provided <paramref name="snapshot"/> into storage.
37 : /// </summary>
38 : /// <param name="snapshot">the <see cref="Snapshot"/> to save and store.</param>
39 1 : void Save(Snapshot snapshot);
40 : }
41 : }
|