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

NAME

6       pmemobj_first(),  pmemobj_next(),  POBJ_FIRST(), POBJ_FIRST_TYPE_NUM(),
7       POBJ_NEXT(), POBJ_NEXT_TYPE_NUM(), POBJ_FOREACH(), POBJ_FOREACH_SAFE(),
8       POBJ_FOREACH_TYPE(), POBJ_FOREACH_SAFE_TYPE() - pmemobj container oper‐
9       ations
10

SYNOPSIS

12              #include <libpmemobj.h>
13
14              PMEMoid pmemobj_first(PMEMobjpool *pop);
15              PMEMoid pmemobj_next(PMEMoid oid);
16
17              POBJ_FIRST(PMEMobjpool *pop, TYPE)
18              POBJ_FIRST_TYPE_NUM(PMEMobjpool *pop, uint64_t type_num)
19              POBJ_NEXT(TOID oid)
20              POBJ_NEXT_TYPE_NUM(PMEMoid oid)
21
22              POBJ_FOREACH(PMEMobjpool *pop, PMEMoid varoid)
23              POBJ_FOREACH_SAFE(PMEMobjpool *pop, PMEMoid varoid, PMEMoid nvaroid)
24              POBJ_FOREACH_TYPE(PMEMobjpool *pop, TOID var)
25              POBJ_FOREACH_SAFE_TYPE(PMEMobjpool *pop, TOID var, TOID nvar)
26

DESCRIPTION

28       The libpmemobj(7) container operations provide a mechanism that  allows
29       iteration  through the internal object collection, either looking for a
30       specific object, or performing a specific operation on each object of a
31       given  type.   Software should not make any assumptions about the order
32       of the objects in the internal object containers.
33
34       The pmemobj_first() function returns the first object from the pool.
35
36       The POBJ_FIRST() macro returns the first object from the  pool  of  the
37       type specified by TYPE.
38
39       The  POBJ_FIRST_TYPE_NUM() macro returns the first object from the pool
40       of the type specified by type_num.
41
42       The pmemobj_next() function returns the next object from the pool.
43
44       The POBJ_NEXT() macro returns the next object of the same type  as  the
45       object referenced by oid.
46
47       The POBJ_NEXT_TYPE_NUM() macro returns the next object of the same type
48       number as the object referenced by oid.
49
50       The following four macros provide a  more  convenient  way  to  iterate
51       through  the  internal  collections, performing a specific operation on
52       each object.
53
54       The POBJ_FOREACH() macro performs a specific operation on each allocat‐
55       ed  object  stored in the persistent memory pool pop.  It traverses the
56       internal collection of all the objects, assigning a handle to each ele‐
57       ment in turn to varoid.
58
59       The POBJ_FOREACH_TYPE() macro performs a specific operation on each al‐
60       located object stored in the persistent memory pool pop  that  has  the
61       same  type as var.  It traverses the internal collection of all the ob‐
62       jects of the specified type, assigning a handle to each element in turn
63       to var.
64
65       The  macros  POBJ_FOREACH_SAFE() and POBJ_FOREACH_SAFE_TYPE() work in a
66       similar fashion as POBJ_FOREACH() and POBJ_FOREACH_TYPE(), except  that
67       prior to performing the operation on the object, they preserve a handle
68       to the next object in the collection by  assigning  it  to  nvaroid  or
69       nvar,  respectively.   This  allows  safe  deletion of selected objects
70       while iterating through the collection.
71

RETURN VALUE

73       pmemobj_first() returns the first object from the pool, or, if the pool
74       is empty, OID_NULL.
75
76       pmemobj_next()  returns  the  next object from the pool.  If the object
77       referenced by oid is the last object in the collection, or  if  oid  is
78       OID_NULL, pmemobj_next() returns OID_NULL.
79

SEE ALSO

81       libpmemobj(7) and <https://pmem.io>
82
83
84
85PMDK -                            2023-06-05                                ()
Impressum