Пример #1
0
static int tc_wal_printer(struct tnt_iter *i) {
	struct tnt_request *r = TNT_IREQUEST_PTR(i);
	struct tnt_stream_xlog *s =
		TNT_SXLOG_CAST(TNT_IREQUEST_STREAM(i));
	tc_wal_print(&s->hdr, r);
	return 0;
}
Пример #2
0
static int
tnt_xlog_request(struct tnt_stream *s, struct tnt_request *r)
{
	struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s);

	struct tnt_log_row *row =
		tnt_log_next_to(&sx->log, (union tnt_log_value*)r);

	if (row == NULL && tnt_log_error(&sx->log) == TNT_LOG_EOK)
		return 1;

	return (row) ? 0: -1;
}
Пример #3
0
int tnt_xlog_reset(struct tnt_stream *s) {
	struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s);
	return tnt_log_seek(&(sx->log), sx->log.begin_offset);
}
Пример #4
0
static void tnt_xlog_free(struct tnt_stream *s) {
	struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s);
	tnt_log_close(&sx->log);
	tnt_mem_free(s->data);
	s->data = NULL;
}
Пример #5
0
/*
 * tnt_xlog_errno()
 *
 * get saved errno;
 *
 * s - xlog stream pointer
*/
int tnt_xlog_errno(struct tnt_stream *s) {
	return TNT_SXLOG_CAST(s)->log.errno_;
}
Пример #6
0
/*
 * tnt_xlog_strerror()
 *
 * get stream error status description string;
 *
 * s - xlog stream pointer
*/
char *tnt_xlog_strerror(struct tnt_stream *s) {
	return tnt_log_strerror(&TNT_SXLOG_CAST(s)->log);
}
Пример #7
0
/*
 * tnt_xlog_error()
 *
 * get stream error status;
 *
 * s - xlog stream pointer
*/
enum tnt_log_error tnt_xlog_error(struct tnt_stream *s) {
	return TNT_SXLOG_CAST(s)->log.error;
}
Пример #8
0
/*
 * tnt_xlog_close()
 *
 * close xlog stream; 
 *
 * s - xlog stream pointer
 * 
 * returns 0 on success, or -1 on error.
*/
void tnt_xlog_close(struct tnt_stream *s) {
	struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s);
	tnt_log_close(&sx->log);
}
Пример #9
0
/*
 * tnt_xlog_open()
 *
 * open xlog file and associate it with stream;
 *
 * s - xlog stream pointer
 * 
 * returns 0 on success, or -1 on error.
*/
int tnt_xlog_open(struct tnt_stream *s, const char *file) {
	struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s);
	return tnt_log_open(&sx->log, file, TNT_LOG_XLOG);
}