A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::stores::ChunkStoreWriter::State Struct Referenceabstract
Inheritance diagram for a11::stores::ChunkStoreWriter::State:
[legend]

Classes

struct  Batch
 
struct  Element
 

Public Types

enum class  Lifecycle { kNone , kClose , kAbort , kCancel }
 
enum class  Operation { kNone , kWrite , kClose }
 

Public Member Functions

 State (std::shared_ptr< ChunkStore > chunk_store, ChunkStoreWriterOptions writer_options)
 
void ApplyStickyMimetypeLocked (data::Chunk &chunk, bool explicit_sequence_gap) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu)
 
void Wake ()
 
void Drive ()
 Run the state machine until it has nothing left to do without waiting.
 
void DriveOnce ()
 
void StartWrite (std::uint64_t generation)
 
void InstallWrite (const a11::Future< std::vector< std::uint32_t > > &pending, std::uint64_t generation)
 
void WriteDone (std::uint64_t generation, const absl::StatusOr< std::vector< std::uint32_t > > &result)
 
void RedrivePump ()
 Hand the pump another pass, from inside a turn or from outside one.
 
void FinishTee (absl::Status tee_status)
 
absl::Status TeeClose (const absl::Status &close_status)
 
void StartClose (std::uint64_t generation, absl::Status requested_status)
 
void CloseDone (std::uint64_t generation, const absl::Status &requested_status, const absl::Status &tee_status, const absl::StatusOr< absl::Status > &result)
 
void AdmitPendingLocked (std::vector< std::shared_ptr< a11::Promise< a11::Unit > > > *admitted) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu)
 
std::uint64_t next_offset_seq ABSL_GUARDED_BY (mu)
 
std::uint64_t next_sticky_seq ABSL_GUARDED_BY (mu)
 
std::string current_mimetype ABSL_GUARDED_BY (mu)
 
std::deque< Element > queue ABSL_GUARDED_BY (mu)
 
std::deque< Element > pending_queue ABSL_GUARDED_BY (mu)
 
size_t outstanding ABSL_GUARDED_BY (mu)=0
 
std::optional< absl::Status > status ABSL_GUARDED_BY (mu)
 
bool closing ABSL_GUARDED_BY (mu)
 
std::optional< absl::Status > stop_status ABSL_GUARDED_BY (mu)
 
Lifecycle lifecycle ABSL_GUARDED_BY (mu)
 
bool lifecycle_completed ABSL_GUARDED_BY (mu)
 
std::shared_ptr< a11::Promise< a11::Unit > > lifecycle_promise ABSL_GUARDED_BY (mu)
 
a11::Task lifecycle_future ABSL_GUARDED_BY (mu)
 
std::vector< std::shared_ptr< a11::Promise< a11::Unit > > > drain_waiters ABSL_GUARDED_BY (mu)
 
std::vector< std::shared_ptr< net::WireStream > > attached_streams ABSL_GUARDED_BY (mu)
 
size_t tees_in_flight ABSL_GUARDED_BY (mu)=0
 
bool queued ABSL_GUARDED_BY (mu)
 
Operation operation ABSL_GUARDED_BY (mu)
 
std::uint64_t operation_generation ABSL_GUARDED_BY (mu)=0
 
a11::Future< std::vector< std::uint32_t > > active_write ABSL_GUARDED_BY (mu)
 
a11::Future< absl::Status > active_close ABSL_GUARDED_BY (mu)
 

Static Public Member Functions

static a11::internal::CallbackScheduler & Scheduler ()
 
static void CompleteElements (std::vector< Element > elements, std::vector< std::uint32_t > sequences, const absl::Status &status)
 

Public Attributes

const std::shared_ptr< ChunkStore > store
 
const ChunkStoreWriterOptions options
 
thread::Mutex mu
 
InlinePumpState pump
 
std::optional< Batch > in_flight_batch
 

Member Enumeration Documentation

◆ Lifecycle

Enumerator
kNone 
kClose 
kAbort 
kCancel 

◆ Operation

Enumerator
kNone 
kWrite 
kClose 

Constructor & Destructor Documentation

◆ State()

a11::stores::ChunkStoreWriter::State::State ( std::shared_ptr< ChunkStore >  chunk_store,
ChunkStoreWriterOptions  writer_options 
)
inline

Member Function Documentation

◆ ABSL_GUARDED_BY() [1/21]

std::uint64_t next_offset_seq a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [2/21]

std::uint64_t next_sticky_seq a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [3/21]

std::string current_mimetype a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [4/21]

std::deque< Element > queue a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [5/21]

std::deque< Element > pending_queue a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [6/21]

std::optional< absl::Status > status a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [7/21]

bool closing a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [8/21]

std::optional< absl::Status > stop_status a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [9/21]

Lifecycle lifecycle a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [10/21]

bool lifecycle_completed a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [11/21]

std::shared_ptr< a11::Promise< a11::Unit > > lifecycle_promise a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [12/21]

a11::Task lifecycle_future a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [13/21]

std::vector< std::shared_ptr< a11::Promise< a11::Unit > > > drain_waiters a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [14/21]

std::vector< std::shared_ptr< net::WireStream > > attached_streams a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [15/21]

bool queued a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [16/21]

Operation operation a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [17/21]

a11::Future< std::vector< std::uint32_t > > active_write a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [18/21]

a11::Future< absl::Status > active_close a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )

◆ ABSL_GUARDED_BY() [19/21]

size_t outstanding a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )
pure virtual

◆ ABSL_GUARDED_BY() [20/21]

size_t tees_in_flight a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )
pure virtual

◆ ABSL_GUARDED_BY() [21/21]

std::uint64_t operation_generation a11::stores::ChunkStoreWriter::State::ABSL_GUARDED_BY ( mu  )
pure virtual

◆ AdmitPendingLocked()

void a11::stores::ChunkStoreWriter::State::AdmitPendingLocked ( std::vector< std::shared_ptr< a11::Promise< a11::Unit > > > *  admitted)
inline

◆ ApplyStickyMimetypeLocked()

void a11::stores::ChunkStoreWriter::State::ApplyStickyMimetypeLocked ( data::Chunk &  chunk,
bool  explicit_sequence_gap 
)
inline

◆ CloseDone()

void a11::stores::ChunkStoreWriter::State::CloseDone ( std::uint64_t  generation,
const absl::Status &  requested_status,
const absl::Status &  tee_status,
const absl::StatusOr< absl::Status > &  result 
)
inline

◆ CompleteElements()

static void a11::stores::ChunkStoreWriter::State::CompleteElements ( std::vector< Element >  elements,
std::vector< std::uint32_t >  sequences,
const absl::Status &  status 
)
inlinestatic

◆ Drive()

void a11::stores::ChunkStoreWriter::State::Drive ( )
inline

Run the state machine until it has nothing left to do without waiting.

Driven on whichever thread asked – Flush() from an awaiting caller, the scheduler from Wake() – so see a11/concurrency/inline_pump.h for why re-entry is bounded by a count rather than marked per thread.

◆ DriveOnce()

void a11::stores::ChunkStoreWriter::State::DriveOnce ( )
inline

◆ FinishTee()

void a11::stores::ChunkStoreWriter::State::FinishTee ( absl::Status  tee_status)
inline

◆ InstallWrite()

void a11::stores::ChunkStoreWriter::State::InstallWrite ( const a11::Future< std::vector< std::uint32_t > > &  pending,
std::uint64_t  generation 
)
inline

◆ RedrivePump()

void a11::stores::ChunkStoreWriter::State::RedrivePump ( )
inline

Hand the pump another pass, from inside a turn or from outside one.

◆ Scheduler()

static a11::internal::CallbackScheduler & a11::stores::ChunkStoreWriter::State::Scheduler ( )
inlinestatic

◆ StartClose()

void a11::stores::ChunkStoreWriter::State::StartClose ( std::uint64_t  generation,
absl::Status  requested_status 
)
inline

◆ StartWrite()

void a11::stores::ChunkStoreWriter::State::StartWrite ( std::uint64_t  generation)
inline

◆ TeeClose()

absl::Status a11::stores::ChunkStoreWriter::State::TeeClose ( const absl::Status &  close_status)
inline

◆ Wake()

void a11::stores::ChunkStoreWriter::State::Wake ( )
inline

◆ WriteDone()

void a11::stores::ChunkStoreWriter::State::WriteDone ( std::uint64_t  generation,
const absl::StatusOr< std::vector< std::uint32_t > > &  result 
)
inline

Member Data Documentation

◆ in_flight_batch

std::optional<Batch> a11::stores::ChunkStoreWriter::State::in_flight_batch

◆ mu

thread::Mutex a11::stores::ChunkStoreWriter::State::mu
mutable

◆ options

const ChunkStoreWriterOptions a11::stores::ChunkStoreWriter::State::options

◆ pump

InlinePumpState a11::stores::ChunkStoreWriter::State::pump

◆ store

const std::shared_ptr<ChunkStore> a11::stores::ChunkStoreWriter::State::store

The documentation for this struct was generated from the following file: