Ejemplo n.º 1
0
        /// <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();
        }
Ejemplo n.º 2
0
        /// <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();
        }
Ejemplo n.º 3
0
 protected override void DoSerializeBix(BixWriter wri, byte[] entry)
 => wri.Write(entry);
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
        protected override void DoSerializeBix(BixWriter wri, object entry)
        {
            string json = entry == null ? null : JsonWriter.Write(entry, JsonWritingOptions.CompactRowsAsMap);

            wri.Write(json);
        }
Ejemplo n.º 6
0
 protected override void DoSerializeBix(BixWriter wri, string entry)
 => wri.Write(entry);
Ejemplo n.º 7
0
 /// <summary>
 /// Override to perform actual TEntry serialization using BixWriter
 /// </summary>
 protected abstract void DoSerializeBix(BixWriter wri, TEntry entry);
Ejemplo n.º 8
0
 protected override void DoSerializeBix(BixWriter wri, StringBookmark entry)
 {
     wri.Write(entry.Value);
     wri.Write(entry.Bookmark.PageId);
     wri.Write(entry.Bookmark.Address);
 }