1() PMDK Programmer's Manual ()
2
3
4
6 pmemlog_tell()(DEPRECATED), pmemlog_rewind()(DEPRECATED), pmem‐
7 log_walk()(DEPRECATED) - checks current write point for the log or
8 walks through the log
9
11 #include <libpmemlog.h>
12
13 long long pmemlog_tell(PMEMlogpool *plp);
14 void pmemlog_rewind(PMEMlogpool *plp);
15 void pmemlog_walk(PMEMlogpool *plp, size_t chunksize,
16 int (*process_chunk)(const void *buf, size_t len, void *arg),
17 void *arg);
18
20 The pmemlog_tell() function returns the current write point for the
21 log, expressed as a byte offset into the usable log space in the memory
22 pool. This offset starts off as zero on a newly-created log, and is
23 incremented by each successful append operation. This function can be
24 used to determine how much data is currently in the log.
25
26 The pmemlog_rewind() function resets the current write point for the
27 log to zero. After this call, the next append adds to the beginning of
28 the log.
29
30 The pmemlog_walk() function walks through the log plp, from beginning
31 to end, calling the callback function process_chunk for each chunksize
32 block of data found. The argument arg is also passed to the callback
33 to help avoid the need for global state. The chunksize argument is
34 useful for logs with fixed-length records and may be specified as 0 to
35 cause a single call to the callback with the entire log contents passed
36 as the buf argument. The len argument tells the process_chunk function
37 how much data buf is holding. The callback function should return 1 if
38 pmemlog_walk() should continue walking through the log, or 0 to termi‐
39 nate the walk. The callback function is called while holding libpmem‐
40 log(7) internal locks that make calls atomic, so the callback function
41 must not try to append to the log itself or deadlock will occur.
42
44 On success, pmemlog_tell() returns the current write point for the log.
45 On error, it returns -1 and sets errno appropriately.
46
47 The pmemlog_rewind() and pmemlog_walk() functions return no value.
48
50 libpmemlog(7) and <https://pmem.io>
51
52
53
54PMDK - 2023-06-05 ()