public void Close() { using (this._lock) { this._closed = true; if (this._currentWriter == null) { return; } var tmp = this._currentWriter; this._currentWriter = null; tmp.Dispose(); } }
void EnsureWriterExists(long version) { if (this._lock.Exception != null) { throw new InvalidOperationException("Can not renew lease", this._lock.Exception); } if (this._currentWriter != null) { return; } var fileName = string.Format("{0:00000000}-{1:yyyy-MM-dd-HHmm}.dat", version, DateTime.UtcNow); var blob = this._container.GetPageBlobReference(fileName); blob.Create(1024 * 512); this._currentWriter = new AppendOnlyStream(512, (i, bytes) => blob.WritePages(bytes, i), 1024 * 512); }
void CloseWriter() { this._currentWriter.Dispose(); this._currentWriter = null; }