/// <summary> /// Mounts an existing volume backed by an optional `IPageCache` implementation instance /// </summary> public DefaultVolume(ICryptoManager crypto, IPageCache cache, Stream stream, bool ownsStream = true) { m_Crypto = crypto.NonNull(nameof(crypto)); m_Cache = cache; m_Stream = stream.NonNull(nameof(stream)); (m_Stream.Length > 0).IsTrue("stream.Empty"); m_Reader = new BixReader(m_Stream); m_Writer = new BixWriter(m_Stream); m_Metadata = readVolumeHeader(); ctor(); }
/// <summary> /// Creates a new volume backed by an optional `IPageCache` implementation instance /// </summary> public DefaultVolume(ICryptoManager crypto, IPageCache cache, VolumeMetadataBuilder metadataBuilder, Stream stream, bool ownsStream = true) { m_Crypto = crypto.NonNull(nameof(crypto)); m_Cache = cache; m_Stream = stream.NonNull(nameof(stream)); (m_Stream.Length == 0).IsTrue("stream.!Empty"); metadataBuilder.Assigned.IsTrue("meta.!Assigned"); m_Reader = new BixReader(m_Stream); m_Writer = new BixWriter(m_Stream); m_Metadata = metadataBuilder.Built; writeVolumeHeader(); ctor(); }
protected override void DoSerializeBix(BixWriter wri, byte[] entry) => wri.Write(entry);
public LogMessageArchiveAppender(IVolume volume, ITimeSource time, Atom app, string host, Action <Message, Bookmark> onPageCommit = null) : base(volume, time, app, host, onPageCommit) { m_Stream = new MemoryStream(); m_Writer = new BixWriter(m_Stream); }
protected override void DoSerializeBix(BixWriter wri, object entry) { string json = entry == null ? null : JsonWriter.Write(entry, JsonWritingOptions.CompactRowsAsMap); wri.Write(json); }
protected override void DoSerializeBix(BixWriter wri, string entry) => wri.Write(entry);
/// <summary> /// Override to perform actual TEntry serialization using BixWriter /// </summary> protected abstract void DoSerializeBix(BixWriter wri, TEntry entry);
protected override void DoSerializeBix(BixWriter wri, StringBookmark entry) { wri.Write(entry.Value); wri.Write(entry.Bookmark.PageId); wri.Write(entry.Bookmark.Address); }