24#ifndef A11_STORES_CHUNK_STORE_READER_H_
25#define A11_STORES_CHUNK_STORE_READER_H_
32#include <absl/status/status.h>
33#include <absl/status/statusor.h>
34#include <absl/time/time.h>
98 static absl::StatusOr<std::shared_ptr<ChunkStoreReader>>
Create(
147 absl::Duration
timeout = absl::InfiniteDuration());
173 size_t limit, absl::Duration
timeout = absl::InfiniteDuration());
176 [[nodiscard]] std::shared_ptr<ChunkStore>
store()
const;
186 : state_(std::move(state)) {}
188 std::shared_ptr<State> state_;
A11's pluggable storage interface for streamed node data: an ordered, appendable log of fragments key...
An ordered, buffered read cursor over a ChunkStore.
Definition chunk_store_reader.h:84
ChunkStoreReaderOptions options() const
Definition chunk_store_reader.cc:806
size_t buffer_size() const
Definition chunk_store_reader.cc:810
void EnsureStarted()
Start the background read pump if it is not already running.
Definition chunk_store_reader.cc:732
a11::Future< std::vector< std::optional< data::NodeFragment > > > NextMany(size_t limit, absl::Duration timeout=absl::InfiniteDuration())
Get up to limit fragments in one await.
Definition chunk_store_reader.cc:759
a11::Task Done() const
Await completion of the background read pump.
Definition chunk_store_reader.cc:745
a11::Future< std::optional< data::NodeFragment > > Next(absl::Duration timeout=absl::InfiniteDuration())
Get the next fragment from the store.
Definition chunk_store_reader.cc:749
std::shared_ptr< ChunkStore > store() const
Definition chunk_store_reader.cc:802
static absl::StatusOr< std::shared_ptr< ChunkStoreReader > > Create(std::shared_ptr< ChunkStore > store, ChunkStoreReaderOptions options={})
Create a reader over store.
Definition chunk_store_reader.cc:710
~ChunkStoreReader()=default
absl::Status GetStatus() const
Get the reader's current status.
Definition chunk_store_reader.cc:740
void Cancel()
Stop the background read pump.
Definition chunk_store_reader.cc:736
Completion values used by every asynchronous A11 operation.
std::optional< absl::Duration > timeout
Definition main.cc:144
Tunables controlling how a ChunkStoreReader delivers and buffers fragments.
Definition chunk_store_reader.h:51
bool ordered
Whether fragments are delivered strictly in sequence order.
Definition chunk_store_reader.h:53
std::uint32_t offset
Sequence number at which reading begins.
Definition chunk_store_reader.h:59
bool pop_chunks
Whether fragments are removed from the store as they are read.
Definition chunk_store_reader.h:55
std::optional< std::uint64_t > max_chunks_to_read
Optional cap on the total number of fragments to read.
Definition chunk_store_reader.h:61
absl::Status Validate() const
Validate that the options are internally consistent.
Definition chunk_store_reader.cc:47
std::uint64_t num_chunks_to_buffer
Maximum number of fragments to prefetch into the buffer.
Definition chunk_store_reader.h:57
bool sticky_mimetype
Whether ordered reads inherit the last explicitly set chunk mimetype.
Definition chunk_store_reader.h:63
Definition chunk_store_reader.cc:59
A11's core wire value types: chunks, node fragments and messages.