public IDisposable Initialize(DatabaseSmugglerOptions options, SmugglerResult result, out long buildVersion) { _result = result; _returnBuffer = _context.GetManagedBuffer(out _buffer); _state = new JsonParserState(); _parser = new UnmanagedJsonParser(_context, _state, "file"); if (UnmanagedJsonParserHelper.Read(_peepingTomStream, _parser, _state, _buffer) == false) { UnmanagedJsonParserHelper.ThrowInvalidJson("Unexpected end of json.", _peepingTomStream, _parser); } if (_state.CurrentTokenType != JsonParserToken.StartObject) { UnmanagedJsonParserHelper.ThrowInvalidJson("Expected start object, but got " + _state.CurrentTokenType, _peepingTomStream, _parser); } buildVersion = ReadBuildVersion(); _buildVersionType = BuildVersion.Type(buildVersion); _readLegacyEtag = options.ReadLegacyEtag; return(new DisposableAction(() => { _parser.Dispose(); _returnBuffer.Dispose(); _returnWriteBuffer.Dispose(); })); }
public void Dispose() { _response.Response.Dispose(); _response.Stream.Dispose(); _parser.Dispose(); _returnBuffer.Dispose(); }
private void DisposeInternal() { _response.Response.Dispose(); _parser.Dispose(); _returnBuffer.Dispose(); _peepingTomStream.Dispose(); _builder.Dispose(); _returnContext.Dispose(); }
private void DisposeIfNeeded(int generation, UnmanagedJsonParser parser, BlittableJsonDocumentBuilder builder) { // if the generation has changed, that means that we had reset the context // this can happen if we were waiting on an async call for a while, got timed out / error / something // and the context was reset before we got back from the async call // since the full context was reset, there is no point in trying to dispose things, they were already // taken care of if (generation == _generation) { parser?.Dispose(); builder?.Dispose(); } }
public void Dispose() { _parser.Dispose(); }
public void Dispose() { _returnManagedBuffer.Dispose(); _parser?.Dispose(); _writer?.Dispose(); }