private TryGetOperation ReadTryGetOperation(BinaryReader reader) { IData key = KeyPersist.Read(reader); IData record = reader.ReadBoolean() ? RecordPersist.Read(reader) : null; return(new TryGetOperation(key, record)); }
private void WriteReplaceCommand(BinaryWriter writer, ICommand command) { var cmd = (ReplaceCommand)command; KeyPersist.Write(writer, cmd.Key); RecordPersist.Write(writer, cmd.Record); }
private RefreshRangeOperation ReadRefreshRangeOperation(BinaryReader reader) { IData from = KeyPersist.Read(reader); IData to = KeyPersist.Read(reader); return(new RefreshRangeOperation(from, to)); }
private InsertOrIgnoreOperation ReadInsertOrIgnoreOperation(BinaryReader reader) { IData key = KeyPersist.Read(reader); IData record = RecordPersist.Read(reader); return(new InsertOrIgnoreOperation(key, record)); }
private void WriteDeleteRangeCommand(BinaryWriter writer, ICommand command) { var cmd = (DeleteRangeCommand)command; KeyPersist.Write(writer, cmd.FromKey); KeyPersist.Write(writer, cmd.ToKey); }
private DeleteRangeOperation ReadDeleteRangeOperation(BinaryReader reader) { IData from = KeyPersist.Read(reader); IData to = KeyPersist.Read(reader); return(new DeleteRangeOperation(from, to)); }
private void WriteInsertOrIgnoreCommand(BinaryWriter writer, ICommand command) { var cmd = (InsertOrIgnoreCommand)command; KeyPersist.Write(writer, cmd.Key); RecordPersist.Write(writer, cmd.Record); }
private ReplaceOperation ReadReplaceOperation(BinaryReader reader) { IData key = KeyPersist.Read(reader); IData record = RecordPersist.Read(reader); return(new ReplaceOperation(key, record)); }
private ReadOperation ReadReadOperation(BinaryReader reader) { IData key = KeyPersist.Read(reader); long handle = reader.ReadInt64(); return(new ReadOperation(key, handle)); }
private LastRowCommand ReadLastRowCommand(BinaryReader reader) { bool hasValue = (reader.ReadBoolean()); IData key = hasValue ? KeyPersist.Read(reader) : null; IData rec = hasValue ? RecordPersist.Read(reader) : null; return(new LastRowCommand(hasValue ? (KeyValuePair <IData, IData>?) new KeyValuePair <IData, IData>(key, rec) : null)); }
private LastRowOperation ReadLastRowOperation(BinaryReader reader) { bool hasValues = (reader.ReadBoolean()); IData key = hasValues ? KeyPersist.Read(reader) : null; IData rec = hasValues ? RecordPersist.Read(reader) : null; return(new LastRowOperation(new KeyValuePair <IData, IData>(key, rec))); }
private void WriteLastRowOperation(BinaryWriter writer, LastRowOperation operation) { writer.Write(operation.Row.HasValue); if (operation.Row.HasValue) { KeyPersist.Write(writer, operation.Row.Value.Key); RecordPersist.Write(writer, operation.Row.Value.Value); } }
private BackwardCommand ReadBackwardCommand(BinaryReader reader) { int pageCount = reader.ReadInt32(); IData from = reader.ReadBoolean() ? KeyPersist.Read(reader) : null; IData to = reader.ReadBoolean() ? KeyPersist.Read(reader) : null; List <KeyValuePair <IData, IData> > list = reader.ReadBoolean() ? DeserializeList(reader) : null; return(new BackwardCommand(pageCount, from, to, list)); }
private ForwardOperation ReadForwardOperation(BinaryReader reader) { int pageCount = reader.ReadInt32(); IData from = reader.ReadBoolean() ? KeyPersist.Read(reader) : null; IData to = reader.ReadBoolean() ? KeyPersist.Read(reader) : null; List <KeyValuePair <IData, IData> > list = reader.ReadBoolean() ? DeserializeList(reader) : null; return(new ForwardOperation(pageCount, from, to, list)); }
private void SerializeList(BinaryWriter writer, List <KeyValuePair <IData, IData> > list, int count) { writer.Write(count); foreach (var kv in list) { KeyPersist.Write(writer, kv.Key); RecordPersist.Write(writer, kv.Value); } }
private FindBeforeCommand ReadFindBeforeCommand(BinaryReader reader) { IData Key = KeyPersist.Read(reader); bool hasValue = (reader.ReadBoolean()); IData key = hasValue ? KeyPersist.Read(reader) : null; IData rec = hasValue ? RecordPersist.Read(reader) : null; return(new FindBeforeCommand(Key, hasValue ? (KeyValuePair <IData, IData>?) new KeyValuePair <IData, IData>(key, rec) : null)); }
private FindBeforeOperation ReadFindBeforeOperation(BinaryReader reader) { IData from = KeyPersist.Read(reader); bool hasValues = (reader.ReadBoolean()); IData key = hasValues ? KeyPersist.Read(reader) : null; IData rec = hasValues ? RecordPersist.Read(reader) : null; return(new FindBeforeOperation(from, new KeyValuePair <IData, IData>(key, rec))); }
private void WriteTryGetOperation(BinaryWriter writer, TryGetOperation operation) { KeyPersist.Write(writer, operation.FromKey); writer.Write(operation.Record != null); if (operation.Record != null) { RecordPersist.Write(writer, operation.Record); } }
private void WriteFindBeforeOperation(BinaryWriter writer, FindBeforeOperation operation) { KeyPersist.Write(writer, operation.FromKey); writer.Write(operation.KeyValue.HasValue); if (operation.KeyValue.HasValue) { KeyPersist.Write(writer, operation.KeyValue.Value.Key); RecordPersist.Write(writer, operation.KeyValue.Value.Value); } }
private void WriteLastRowCommand(BinaryWriter writer, ICommand command) { var cmd = (LastRowCommand)command; writer.Write(cmd.Row.HasValue); if (cmd.Row.HasValue) { KeyPersist.Write(writer, cmd.Row.Value.Key); RecordPersist.Write(writer, cmd.Row.Value.Value); } }
private void WriteTryGetCommand(BinaryWriter writer, ICommand command) { var cmd = (TryGetCommand)command; KeyPersist.Write(writer, cmd.Key); writer.Write(cmd.Record != null); if (cmd.Record != null) { RecordPersist.Write(writer, cmd.Record); } }
private void WriteFindBeforeCommand(BinaryWriter writer, ICommand command) { var cmd = (FindBeforeCommand)command; KeyPersist.Write(writer, cmd.Key); writer.Write(cmd.KeyValue.HasValue); if (cmd.KeyValue.HasValue) { KeyPersist.Write(writer, cmd.KeyValue.Value.Key); RecordPersist.Write(writer, cmd.KeyValue.Value.Value); } }
private List <KeyValuePair <IData, IData> > DeserializeList(BinaryReader reader) { int count = reader.ReadInt32(); List <KeyValuePair <IData, IData> > list = new List <KeyValuePair <IData, IData> >(count); for (int i = 0; i < count; i++) { IData key = KeyPersist.Read(reader); IData rec = RecordPersist.Read(reader); list.Add(new KeyValuePair <IData, IData>(key, rec)); } return(list); }
private void WriteBackwardOperation(BinaryWriter writer, BackwardOperation operation) { writer.Write(operation.PageCount); writer.Write(operation.FromKey != null); if (operation.FromKey != null) { KeyPersist.Write(writer, operation.FromKey); } writer.Write(operation.ToKey != null); if (operation.ToKey != null) { KeyPersist.Write(writer, operation.ToKey); } writer.Write(operation.List != null); if (operation.List != null) { SerializeList(writer, operation.List, operation.List.Count); } }
private void WriteForwardCommand(BinaryWriter writer, ICommand command) { var cmd = (ForwardCommand)command; writer.Write(cmd.PageCount); writer.Write(cmd.FromKey != null); if (cmd.FromKey != null) { KeyPersist.Write(writer, cmd.FromKey); } writer.Write(cmd.ToKey != null); if (cmd.ToKey != null) { KeyPersist.Write(writer, cmd.ToKey); } writer.Write(cmd.List != null); if (cmd.List != null) { SerializeList(writer, cmd.List, cmd.List.Count); } }
private TryGetCommand ReadTryGetCommand(BinaryReader reader) { return(new TryGetCommand(KeyPersist.Read(reader), reader.ReadBoolean() ? RecordPersist.Read(reader) : null)); }
private InsertOrIgnoreCommand ReadInsertOrIgnoreCommand(BinaryReader reader) { return(new InsertOrIgnoreCommand(KeyPersist.Read(reader), RecordPersist.Read(reader))); }
private DeleteRangeCommand ReadDeleteRangeCommand(BinaryReader reader) { return(new DeleteRangeCommand(KeyPersist.Read(reader), KeyPersist.Read(reader))); }
private ReplaceCommand ReadReplaceCommand(BinaryReader reader) { return(new ReplaceCommand(KeyPersist.Read(reader), RecordPersist.Read(reader))); }
private void WriteReadRangeOperation(BinaryWriter writer, ReadRangeOperation operation) { KeyPersist.Write(writer, operation.FromKey); KeyPersist.Write(writer, operation.ToKey); writer.Write(operation.Handle); }