/// <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(); }