xapian-core  1.4.26
Functions
replicate_utils.h File Reference

Utility functions for replication implementations. More...

#include <string>
+ Include dependency graph for replicate_utils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int create_changeset_file (const std::string &changeset_dir, const std::string &filename, std::string &changes_name)
 Create a new changeset file, and return an open fd for writing to it. More...
 
void write_and_clear_changes (int changes_fd, std::string &buf, size_t bytes)
 Write some changes from a buffer, and then drop them from the buffer. More...
 

Detailed Description

Utility functions for replication implementations.

Definition in file replicate_utils.h.

Function Documentation

◆ create_changeset_file()

int create_changeset_file ( const std::string &  changeset_dir,
const std::string &  filename,
std::string &  changes_name 
)

Create a new changeset file, and return an open fd for writing to it.

Creates the changeset directory, if required.

If there is already a changeset file of the given name, it is truncated by this.

Parameters
changeset_dirThe directory for the changesets.
filenameThe name of the changeset file.
changes_nameA string which will be set to the path of the changeset file.
Returns
The open file descriptor.
Exceptions
Xapian::DatabaseErrorif the changeset couldn't be opened.

Definition at line 43 of file replicate_utils.cc.

References O_CLOEXEC, and posixy_open.

Referenced by ChertDatabaseReplicator::apply_changeset_from_conn(), and ChertDatabase::set_revision_number().

◆ write_and_clear_changes()

void write_and_clear_changes ( int  changes_fd,
std::string &  buf,
size_t  bytes 
)

Write some changes from a buffer, and then drop them from the buffer.

Parameters
changes_fdThe file descriptor to write to (-1 to skip writing).
bufThe buffer holding the changes.
bytesThe number of bytes to write and drop.

Definition at line 60 of file replicate_utils.cc.

References io_write().

Referenced by ChertDatabaseReplicator::apply_changeset_from_conn(), ChertDatabaseReplicator::process_changeset_chunk_base(), and ChertDatabaseReplicator::process_changeset_chunk_blocks().