ark::logging::LogWriter
Defined in header “ark/logging/log_writer.hh”.
A log writer allows you to write a log out to disk. A log consists of indexed columns of data, organized to be read efficiently. You can store any number of message types within a log.
Methods
-
LogWriter(LogWriterConfiguration config)
Constructor. Initializes a new log writer. -
~LogWriter()
Destructor. Cleans up may throw exceptions if you haven’t already called close(). -
void flush()
Flushes the log writer, ensuring everything is written out to disk. This will walk through all active writers and flush them. -
void close()
Closes the log writer, ensuring everything is written out to disk. No further changes can be made to the log. This function may throw if there was an error closing the log, but you cannot call close() again (ie, to retry), regardless. This function is final.Calling flush() before this is a good way to ensure that everything is “safe” to call close(), as if flush() fails, you can retry.
-
Manifest manifest()
Retrieves the manifest for this log. This will be reconstructed when you call this, so it could take some time. It will also change each time you write new data to the log.It is safe to assume the manifest is “final” if you call this after you have closed a log.
-
LogWriterStatistics statistics()
Returns current statistics from the log writer. -
const LogWriterConfiguration & config()
Returns the configuration for this log writer. -
void write(const ObjectDeclaration & declaration, const LoggingClock::time_point & indexed_time, const core::ByteBuffer & data)
Writes the given byte buffer out to the log, assuming it came from the specified object type. This object is indexed according to the “indexed time” variable. -
void register_metadata(const std::string & metadata_key, const std::string & metadata_value)
Register data for the manifest’s metadata section. -
void determine_metadata(LogMetadataEntries & metadata)
Read the current metadata associated wtih the log. -
void rename_log(const std::string & new_name)
Rename the log. This renames the log (previously initialized in the log writer configuration). You must call flush() again before the new name is applied to disk.