xapian-core  1.4.25
Functions
replicate_utils.cc File Reference

Utility functions for replication implementations. More...

#include <config.h>
#include "replicate_utils.h"
#include "xapian/error.h"
#include "io_utils.h"
#include "posixy_wrapper.h"
#include "safefcntl.h"
#include "safesysstat.h"
#include "safeunistd.h"
#include <sys/types.h>
#include <cerrno>
#include <string>
+ Include dependency graph for replicate_utils.cc:

Go to the source code of this file.

Functions

int create_changeset_file (const string &changeset_dir, const string &filename, 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, 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.cc.

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().