Interface ChunkResponseParser<H extends ChunkHeader,ROW extends ChunkRow,T extends ChunkTrailer>
-
- All Known Implementing Classes:
AnalyticsChunkResponseParser
,BaseChunkResponseParser
,QueryChunkResponseParser
,SearchChunkResponseParser
,ViewChunkResponseParser
public interface ChunkResponseParser<H extends ChunkHeader,ROW extends ChunkRow,T extends ChunkTrailer>
Defines the common parser interface for all chunked response parser implementations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cleanup()
Releases resources managed by the parser and prepares it for reuse.Optional<Throwable>
decodingFailure()
If the parser fails due to malformed input the cause is returned here.void
endOfInput()
Indicates the complete JSON document has been fed to the parser.Optional<Throwable>
error()
If the parser sees an error, it should fill this optional so that if the IO layer needs to fail the topmost future it will be passed in.void
feed(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf input)
Parses the given JSON document fragment.Optional<H>
header()
Once the header is completely available, returns a non-absent value of it.void
initialize(com.couchbase.client.core.deps.io.netty.channel.ChannelConfig channelConfig)
Begins a new parsing session.Flux<ROW>
rows()
Returns the currently assigned flux for the rows.Mono<T>
trailer()
Returns the currently assigned mono for the trailer bits.
-
-
-
Method Detail
-
header
Optional<H> header()
Once the header is completely available, returns a non-absent value of it.It is important to provide a non-absent value even if some parts are optional because the related IO components will only proceed if a header is available eventually.
-
error
Optional<Throwable> error()
If the parser sees an error, it should fill this optional so that if the IO layer needs to fail the topmost future it will be passed in.
-
decodingFailure
Optional<Throwable> decodingFailure()
If the parser fails due to malformed input the cause is returned here.
-
initialize
void initialize(com.couchbase.client.core.deps.io.netty.channel.ChannelConfig channelConfig)
Begins a new parsing session.- Parameters:
channelConfig
- the channel config used for backpressure auto-read.
-
cleanup
void cleanup()
Releases resources managed by the parser and prepares it for reuse.
-
feed
void feed(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf input)
Parses the given JSON document fragment. The parser takes ownership of the buffer and is responsible for releasing it.
-
endOfInput
void endOfInput()
Indicates the complete JSON document has been fed to the parser.
-
-