xapian-core
1.4.26
|
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>
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... | |
Utility functions for replication implementations.
Definition in file replicate_utils.cc.
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.
changeset_dir | The directory for the changesets. |
filename | The name of the changeset file. |
changes_name | A string which will be set to the path of the changeset file. |
Xapian::DatabaseError | if 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().
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.
changes_fd | The file descriptor to write to (-1 to skip writing). |
buf | The buffer holding the changes. |
bytes | The 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().