123 const Bytes& data, int64_t* microseconds_timestamp =
nullptr,
bool immediate =
false)
override;
156 void open(
const std::string& path);
160 bool write(
const std::string& url,
const std::string& ser_type,
SchemaType schema_type,
ActionType action_type,
161 const Bytes& data, int64_t microseconds_timestamp);
163 bool write_filex(
bool complete =
true);
169 bool rollback_cache();
173 bool load_schema(
const std::string& ser_type,
SchemaType& schema_type,
SchemaData& schema_data);
175 bool insert_schema(
const SchemaData& schema_data);
177 std::unique_ptr<struct DatabaseWriterImpl> impl_;
Abstract base class for VLink bag file recording with split, compression and global writer support.
BagWriter(const std::string &path, const Config &config={})
Constructs a BagWriter for path with the given config.
std::function< void(int split_index, const std::string &split_filename)> SplitCallback
Callback fired when a split occurs.
Definition bag_writer.h:154
std::function< SchemaData(const std::string &ser_type, SchemaType schema_type)> SchemaCallback
Callback that resolves a serialisation type string to a SchemaData.
Definition bag_writer.h:165
Versatile 128-byte byte buffer with SBO, five ownership modes and compression helpers.
Definition bytes.h:113
void register_split_callback(SplitCallback &&callback, bool before) override
Registers a callback invoked when a file split occurs.
bool push_schema(const SchemaData &schema_data, bool immediate=false) override
Embeds a SchemaData into the SQLite bag for offline introspection.
size_t get_max_task_count() const override
Returns the maximum queue depth.
void set_url_loss(const std::string &url, double loss) override
Sets the expected message loss ratio for a given URL.
void on_end() override
Called from the loop thread just after the last task has been processed.
~DatabaseWriter() override
Destructor – commits remaining cached writes and closes the SQLite database.
bool is_dumping() const override
Returns true if the writer is actively recording to disk.
bool is_split_mode() const override
Returns true if split-file mode is active.
void on_begin() override
Called from the loop thread just before the first task is processed.
DatabaseWriter(const std::string &path, const Config &config={})
Constructs a DatabaseWriter for the given path.
int get_split_index() const override
Returns the zero-based index of the current split file.
void register_schema_callback(SchemaCallback &&callback) override
Registers a callback that resolves serialisation type strings to SchemaData.
int64_t push(const std::string &url, const std::string &ser_type, SchemaType schema_type, ActionType action_type, const Bytes &data, int64_t *microseconds_timestamp=nullptr, bool immediate=false) override
Records one message to the SQLite bag file.
#define VLINK_EXPORT
Definition macros.h:85
#define VLINK_DISALLOW_COPY_AND_ASSIGN(classname)
Deletes the copy constructor and copy-assignment operator of classname.
Definition macros.h:184
SchemaType
Coarse runtime schema family used by discovery, bag metadata, and proxy routing.
Definition types.h:184
ActionType
Identifies the type of message action for recording purposes.
Definition types.h:162
Configuration for recording behaviour, splitting, compression, and limits.
Definition bag_writer.h:122
Carries one serialized schema blob for runtime registration or embedding.
Definition types.h:246