Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
POBJ_LAYOUT_BEGIN(3)	   PMDK	Programmer's Manual	  POBJ_LAYOUT_BEGIN(3)

NAME
       POBJ_LAYOUT_BEGIN(),  POBJ_LAYOUT_TOID(), POBJ_LAYOUT_ROOT(), POBJ_LAY-
       OUT_NAME(),  POBJ_LAYOUT_END(),	POBJ_LAYOUT_TYPES_NUM()	 -  persistent
       memory transactional object store layout

SYNOPSIS
	      #include <libpmemobj.h>

	      POBJ_LAYOUT_BEGIN(layout)
	      POBJ_LAYOUT_TOID(layout, TYPE)
	      POBJ_LAYOUT_ROOT(layout, ROOT_TYPE)
	      POBJ_LAYOUT_NAME(layout)
	      POBJ_LAYOUT_END(layout)
	      POBJ_LAYOUT_TYPES_NUM(layout)

DESCRIPTION
       libpmemobj(7)  defines  a set of	macros for convenient declaration of a
       pool's layout.  The layout declaration consists of  declarations	 of  a
       number  of used types.  The declared types will be assigned consecutive
       type numbers.  Declared types may be  used  in  conjunction  with  type
       safety macros (see TOID_DECLARE(3)).  Once created, the layout declara-
       tion must not be	changed	unless any new types are added at the  end  of
       the  existing  layout  declaration.  Modifying any existing declaration
       may lead	to changes in the type numbers of  declared  types,  which  in
       consequence may cause data corruption.

       The  POBJ_LAYOUT_BEGIN()	macro indicates	a begin	of declaration of lay-
       out.  The LAYOUT	argument is a name of layout.  This argument  must  be
       passed to all macros related to the declaration of layout.

       The  POBJ_LAYOUT_TOID()	macro  declares	a typed	OID for	type passed as
       TYPE argument inside the	declaration of layout.	All types declared us-
       ing  this macro are assigned with consecutive type numbers.  This macro
       must be used  between  the  POBJ_LAYOUT_BEGIN()	and  POBJ_LAYOUT_END()
       macros, with the	same name passed as LAYOUT argument.

       The  POBJ_LAYOUT_ROOT()	macro  declares	a typed	OID for	type passed as
       ROOT_TYPE argument inside the declaration of  layout.   The  typed  OID
       will be assigned	with type number for root object POBJ_ROOT_TYPE_NUM.

       The POBJ_LAYOUT_END() macro ends	the declaration	of layout.

       The  POBJ_LAYOUT_NAME() macro returns the name of layout	as a null-ter-
       minated string.

       The POBJ_LAYOUT_TYPES_NUM() macro returns number	of types declared  us-
       ing the POBJ_LAYOUT_TOID() macro	within the layout declaration.

EXAMPLE
       This is an example of layout declaration:

	      POBJ_LAYOUT_BEGIN(mylayout);
	      POBJ_LAYOUT_ROOT(mylayout, struct	root);
	      POBJ_LAYOUT_TOID(mylayout, struct	node);
	      POBJ_LAYOUT_TOID(mylayout, struct	foo);
	      POBJ_LAYOUT_END(mylayout);

	      struct root
	      {
		  TOID(struct node) node;
	      };

	      struct node
	      {
		  TOID(struct node) next;
		  TOID(struct foo) foo;
	      };

       The  name  of  layout and the number of declared	types can be retrieved
       using the following code:

	      const char *layout_name =	POBJ_LAYOUT_NAME(mylayout);
	      int num_of_types = POBJ_LAYOUT_TYPES_NUM(mylayout);

SEE ALSO
       TOID_DECLARE(3),	libpmemobj(7) and <http://pmem.io>

PMDK - pmemobj API version 2.3	  2019-07-10		  POBJ_LAYOUT_BEGIN(3)

NAME | SYNOPSIS | DESCRIPTION | EXAMPLE | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=pobj_layout_begin&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help