1PMEMLOG_TELL(3)            PMDK Programmer's Manual            PMEMLOG_TELL(3)
2
3
4

NAME

6       pmemlog_tell(), pmemlog_rewind(), pmemlog_walk() - checks current write
7       point for the log or walks through the log
8

SYNOPSIS

10              #include <libpmemlog.h>
11
12              long long pmemlog_tell(PMEMlogpool *plp);
13              void pmemlog_rewind(PMEMlogpool *plp);
14              void pmemlog_walk(PMEMlogpool *plp, size_t chunksize,
15                  int (*process_chunk)(const void *buf, size_t len, void *arg),
16                  void *arg);
17

DESCRIPTION

19       The pmemlog_tell() function returns the current  write  point  for  the
20       log, expressed as a byte offset into the usable log space in the memory
21       pool.  This offset starts off as zero on a newly-created  log,  and  is
22       incremented  by each successful append operation.  This function can be
23       used to determine how much data is currently in the log.
24
25       The pmemlog_rewind() function resets the current write  point  for  the
26       log to zero.  After this call, the next append adds to the beginning of
27       the log.
28
29       The pmemlog_walk() function walks through the log plp,  from  beginning
30       to  end, calling the callback function process_chunk for each chunksize
31       block of data found.  The argument arg is also passed to  the  callback
32       to  help  avoid  the  need for global state.  The chunksize argument is
33       useful for logs with fixed-length records and may be specified as 0  to
34       cause a single call to the callback with the entire log contents passed
35       as the buf argument.  The len argument tells the process_chunk function
36       how much data buf is holding.  The callback function should return 1 if
37       pmemlog_walk() should continue walking through the log, or 0 to  termi‐
38       nate  the walk.  The callback function is called while holding libpmem‐
39       log(7) internal locks that make calls atomic, so the callback  function
40       must not try to append to the log itself or deadlock will occur.
41

RETURN VALUE

43       On success, pmemlog_tell() returns the current write point for the log.
44       On error, it returns -1 and sets errno appropriately.
45
46       The pmemlog_rewind() and pmemlog_walk() functions return no value.
47

SEE ALSO

49       libpmemlog(7) and <https://pmem.io>
50
51
52
53PMDK - pmemlog API version 1.1    2020-10-28                   PMEMLOG_TELL(3)
Impressum