Aris Setyawan wrote:
Hi,
I'm new in this list.
I plan to store graph data structure (vertex and edge) in LMDB. The
"edge" data value of a record will contain a pointer which is pointing
to the address of "vertex" data value. So, I must make it sure that
data value address is not changing during operation. According to the
doc, I can use MDB_FIXEDMAP.
And from the doc:
"... the memory map will always reside at the same virtual address and
pointers used to reference data items in the database will be constant
across multiple invocations. ..."
Spesifically: "... pointers used to reference data items in the
database will be constant ..."
Is this mean that I must allocate memory to write data using mdb_put
with MDB_RESERVE flag?
Yes, but from what you've described, this will not do what you want. The
address of a record is not guaranteed to remain constant, so you cannot
safely
reference the address of one record from another record. The only safe way
to
reference one record from another is using its key.
If you want to create a record which has fields referencing the addresses of
other fields within the same record, that is the goal for FIXEDMAP but this
feature requires the relocation functions, which currently are not
implemented.