Commit 7aec15ca authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Add a VSL_COPT_TAILSTOP cursor option to the VSM cursor

If this option is set, the cursor will return EOF when reaching the log tail.
parent fa0f8b40
......@@ -201,8 +201,9 @@ void VSL_ResetError(struct VSL_data *vsl);
* Reset any error message.
*/
#define VSL_COPT_TAIL (1 << 0)
#define VSL_COPT_BATCH (1 << 1)
#define VSL_COPT_TAIL (1 << 0)
#define VSL_COPT_BATCH (1 << 1)
#define VSL_COPT_TAILSTOP (1 << 2)
struct VSL_cursor *VSL_CursorVSM(struct VSL_data *vsl, struct VSM_data *vsm,
unsigned options);
/*
......@@ -212,6 +213,7 @@ struct VSL_cursor *VSL_CursorVSM(struct VSL_data *vsl, struct VSM_data *vsm,
* Options:
* VSL_COPT_TAIL Start cursor at log tail
* VSL_COPT_BATCH Return batch records
* VSL_COPT_TAILSTOP Return EOF when reaching the log tail
*
* Return values:
* non-NULL: Pointer to cursor
......@@ -267,7 +269,7 @@ int VSL_Next(struct VSL_cursor *c);
* Return values:
* 1: Cursor points to next log record
* 0: End of log
* -1: End of file (-r) (XXX / -k arg exhausted / "done")
* -1: End of file
* -2: Remote abandoned or closed
* -3: Overrun
* -4: I/O read error - see errno
......
......@@ -164,7 +164,11 @@ vslc_vsm_next(struct VSL_cursor *cursor)
c->next.ptr = c->head->log;
continue;
}
return (0);
if (c->options & VSL_COPT_TAILSTOP)
/* EOF */
return (-1);
else
return (0);
}
if (c->next.ptr == c->head->log)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment