MySQL 9.1.0
Source Code Documentation
binlog::services::iterator::FileStorage Class Reference

#include <file_storage.h>

Static Public Member Functions

static bool register_service ()
 This registers runtime binary log related file services in the service registry. More...
 
static bool unregister_service ()
 This unregisters runtime binary log related file storage services from the server registry. More...
 
static Binlog_iterator_service_init_status init (my_h_binlog_storage_iterator *iterator, const char *excluded_gtids_as_string) noexcept
 Initializes the iterator. More...
 
static Binlog_iterator_service_get_status get (my_h_binlog_storage_iterator iterator, unsigned char *buffer, uint64_t buffer_capacity, uint64_t *bytes_read) noexcept
 Returns the next entry in the log files, end-of-file, or an error. More...
 
static void deinit (my_h_binlog_storage_iterator iterator) noexcept
 Destroys the iterator. More...
 
static mysql_service_status_t get_storage_details (my_h_binlog_storage_iterator iterator, char *buffer, uint64_t *size) noexcept
 Gets details about the entry's storage in a JSON format. More...
 
static mysql_service_status_t get_next_entry_size (my_h_binlog_storage_iterator iterator, uint64_t *size) noexcept
 Gets the size of the next block to be read. More...
 

Static Public Attributes

static const std::string SERVICE_NAME {"binlog_storage_iterator.file"}
 The fully qualified service name: "binlog_storage_iterator.file". More...
 

Member Function Documentation

◆ deinit()

void binlog::services::iterator::FileStorage::deinit ( my_h_binlog_storage_iterator  iterator)
staticnoexcept

Destroys the iterator.

Parameters
[in]iteratorthe iterator to destroy.

◆ get()

Binlog_iterator_service_get_status binlog::services::iterator::FileStorage::get ( my_h_binlog_storage_iterator  iterator,
unsigned char *  buffer,
uint64_t  buffer_capacity,
uint64_t *  bytes_read 
)
staticnoexcept

Returns the next entry in the log files, end-of-file, or an error.

Parameters
[in]iteratorthe iterator context
[in,out]bufferthe buffer where to put the next value.
[in]buffer_capacitythe buffer size.
[out]bytes_readthe size of the value added to the buffer. If the value is larger than the buffer length, then an error is returned and this value is undefined.
Note
If there are new transactions being written to the log file after the iterator has been opened, get will return them if the iterator is not disposed before reaching that point in the log.
If the log file rotates after the iterator has been opened, the iterator itself shall rotate to the new file as well.
The iterator will stop once it reached the end of the most recent log file.
Return values
kBinlogIteratorGetOkif the operation succeeded.
kBinlogIteratorGetEndOfChangesif there are no more events to read. The iterator is still valid and if you call get again you either get the same error back or new entries that may have been added in the meantime.
kBinlogIteratorGetInsufficientBufferif the buffer is insufficient to store the next entry. The iterator is still valid and you can call try to get another entry with a larger buffer.
kBinlogIteratorGetErrorClosedif the log is closed. The iterator is still valid, but retrying will get the same error back as long as the change log is closed.
kBinlogIteratorGetErrorInvalidif the iterator itself has become invalid. This can happen if the memory structures of the iterator are tampered with. The iterator state is invalid and therefore the behavior is undefined if one retries getting the next entry. May result on the same error again. This iterator should be de-initialized and a new one created.
kBinlogIteratorGetErrorUnspecifiedif there was an undefined error while reading the next entry. The iterator state is invalid and therefore the behavior is undefined if one retries getting the next entry. May result on the same error again. This iterator should be de-initialized and a new one created.

◆ get_next_entry_size()

mysql_service_status_t binlog::services::iterator::FileStorage::get_next_entry_size ( my_h_binlog_storage_iterator  iterator,
uint64_t *  size 
)
staticnoexcept

Gets the size of the next block to be read.

This member function can be used to check how larger the size of the buffer to read the next block/event shall be. Note though that if the next block ends up being skipped the obtained via this function is obsolete and a new get_next_entry_size may have to be executed to fetch the buffer needed for the next entry. Therefore it is a good practice for the caller to loop over a get function while it returns insufficient buffer and thus allocate a bigger buffer in that case.

Parameters
[in]iteratorthe iterator context.
[out]sizea pointer that stores the size if the function returns successfully.
Returns
false on success, true otherwise.

◆ get_storage_details()

mysql_service_status_t binlog::services::iterator::FileStorage::get_storage_details ( my_h_binlog_storage_iterator  iterator,
char *  buffer,
uint64_t *  size 
)
staticnoexcept

Gets details about the entry's storage in a JSON format.

Parameters
[in]iteratora valid iterator, i.e., one that has been initialized and not destroyed yet.
[in,out]bufferThe buffer to store the information in.
[in,out]sizeAs input, the size of the buffer provided. As output, the size of the data copied into the buffer.
Returns
false on success, true otherwise.

◆ init()

Binlog_iterator_service_init_status binlog::services::iterator::FileStorage::init ( my_h_binlog_storage_iterator iterator,
const char *  excluded_gtids_as_string 
)
staticnoexcept

Initializes the iterator.

This function must be called prior to using the iterator.

Parameters
[out]iteratora pointer to the iterator to initialize.
[in]excluded_gtids_as_stringthe set of transaction identifiers to skip while reading from the log.
Return values
kBinlogIteratorInitOkif the operation concluded successfully.
kBinlogIteratorIniErrorPurgedGtidsif the iterator was not successfully initialized due to transactions having been purged.
kBinlogIteratorInitErrorLogClosedif the iterator was not successfully initialized because the log is closed.
BINLOG_INIT_ITERATOR_ERROR_UNDEFif the iterator was not initialized due to an undefined error.

◆ register_service()

bool binlog::services::iterator::FileStorage::register_service ( )
static

This registers runtime binary log related file services in the service registry.

This function is called at server startup.

Returns
true on failure
false on success

◆ unregister_service()

bool binlog::services::iterator::FileStorage::unregister_service ( )
static

This unregisters runtime binary log related file storage services from the server registry.

This function is called, when the binary log is closed or when the server is shutting down.

Returns
true on failure.
false on success.

Member Data Documentation

◆ SERVICE_NAME

const std::string binlog::services::iterator::FileStorage::SERVICE_NAME {"binlog_storage_iterator.file"}
static

The fully qualified service name: "binlog_storage_iterator.file".


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