Ejemplo n.º 1
0
        /// <summary>
        /// Adds a new <see cref="Snapshot"/> to the snapshot store.
        /// </summary>
        /// <param name="snapshot">The snapshot to save to the snapshot store.</param>
        public void Save(Snapshot snapshot)
        {
            Verify.NotDisposed(this, disposed);

            if (useAsyncWrite)
            {
                buffer.Add(snapshot.StreamId, snapshot.Version, serializer.Serialize(snapshot.State));
            }
            else
            {
                if (replaceExisting)
                {
                    UpdateSnapshot(snapshot);
                }
                else
                {
                    InsertSnapshot(snapshot);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Mark the specified commit as being dispatched.
        /// </summary>
        /// <param name="id">The unique commit identifier that has been dispatched.</param>
        public void MarkDispatched(Int64 id)
        {
            Verify.NotDisposed(this, disposed);

            if (useAsyncWrite)
            {
                dispatchedBuffer.Add(id);
            }
            else
            {
                using (var command = dialect.CreateCommand(dialect.MarkDispatched))
                {
                    Log.Trace("Marking commit {0} as dispatched", id);

                    command.Parameters.Add(dialect.CreateIdParameter(id));

                    dialect.ExecuteNonQuery(command);
                }
            }
        }