public void Record(SnapshotItem item) { Attempt(() => { if (this.currentSnapshot == null) { return; } var keyBytes = item.Key.ToByteArray(); this.currentSnapshot.Write(keyBytes.Length); this.currentSnapshot.Write(keyBytes); var typeBytes = item.MementoType.ToByteArray(); this.currentSnapshot.Write(typeBytes.Length); this.currentSnapshot.Write(typeBytes); var serializedLength = item.Serialized == null ? 0 : item.Serialized.Length; this.currentSnapshot.Write(serializedLength); if (item.Serialized != null && serializedLength > 0) { this.currentSnapshot.Write(item.Serialized); } }); }
private void IncludeItem(IDbCommand command, int i, SnapshotItem item) { command.WithParameter("@i" + i, item.Key, DbType.String); command.WithParameter("@s" + i, item.CurrentSequence, DbType.Int64); command.WithParameter("@h" + i, item.ComputedHash, DbType.UInt32); command.WithParameter("@d" + i, item.Serialized, DbType.Binary); this.builder.AppendFormat(Upsert, i); }
public void Record(SnapshotItem item) { this.catalog[item.Key] = item; }