nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
nanommo::Recorder Class Reference

#include <recorder.h>

Public Types

using Sink = std::function<absl::Status(std::string_view rows)>
 Stores a batch of rows, one a line, or says why it couldn't.

Public Member Functions

 Recorder (Redis &redis, std::string consumer, Sink sink, std::chrono::milliseconds wait=std::chrono::seconds(1))
 Waits up to wait each time for events to come, as the consumer.
absl::StatusOr< int > Record ()

Static Public Attributes

static constexpr char kGroup [] = "recorder"
static constexpr int kBatch = 10'000
 The most rows a batch takes.

Detailed Description

Takes the game's events from the Redis stream the worlds add them to, a batch at a time, to the sink, which puts them into ClickHouse.

Definition at line 17 of file recorder.h.

Member Typedef Documentation

◆ Sink

using nanommo::Recorder::Sink = std::function<absl::Status(std::string_view rows)>

Stores a batch of rows, one a line, or says why it couldn't.

Definition at line 20 of file recorder.h.

Constructor & Destructor Documentation

◆ Recorder()

nanommo::Recorder::Recorder ( Redis & redis,
std::string consumer,
Sink sink,
std::chrono::milliseconds wait = std::chrono::seconds(1) )

Waits up to wait each time for events to come, as the consumer.

Definition at line 13 of file recorder.cc.

Member Function Documentation

◆ Record()

absl::StatusOr< int > nanommo::Recorder::Record ( )

Records a batch: first what it took before and couldn't store, then what's new. Returns how many it stored.

Definition at line 20 of file recorder.cc.

Member Data Documentation

◆ kBatch

int nanommo::Recorder::kBatch = 10'000
staticconstexpr

The most rows a batch takes.

Definition at line 28 of file recorder.h.

◆ kGroup

char nanommo::Recorder::kGroup[] = "recorder"
staticconstexpr

The consumer group the recorders read the stream as. Redis gives each entry to one consumer of the group, and remembers which it's given out and not had acknowledged.

Definition at line 25 of file recorder.h.


The documentation for this class was generated from the following files: