lmdb-go icon indicating copy to clipboard operation
lmdb-go copied to clipboard

lmdb: Unsupported features

Open bmatsuo opened this issue 9 years ago • 4 comments

Unsupported C functions:

  • [x] ~~mdb_env_get_fd*~~ (#3)
  • [ ] mdb_env_set_userctx*/mdb_env_get_userctx*
    • See comment below.
    • Why not put a field in the Env struct instead to avoid cgo call overhead?
  • [x] ~~mdb_env_set_assert*~~ (wontfix)
  • [ ] mdb_set_compare**/mdb_set_dupsort** and mdb_cmp/mdb_dcmp (#12)(#61)
  • [ ] mdb_set_relfunc*/mdb_set_relctx*

* -- It's currently unclear what benefits this brings ** -- If this can be achieved it will not be trivial for users to instrument

Unusable flags:

  • [ ] MDB_INTEGERKEY/MDB_INTEGERDUP (#11)

bmatsuo avatar Oct 14 '15 23:10 bmatsuo

Passing a pointer to the mdb_set_userctx function violates the cgo tool restrictions mentioned in #10.

C code must not store any Go pointers into Go memory, even temporarily.

This makes use of the function very dubious. Storing a size_t integer value as user context does not seem very useful.

bmatsuo avatar Oct 27 '15 22:10 bmatsuo

I don't plan on implementing mdb_env_set_assert.

This hack should become obsolete as lmdb's error handling matures.

In my own experience its use has not been desired. And if it were to be supported there would be implementation issues. I'm just going to wait for further development.

bmatsuo avatar Oct 29 '15 00:10 bmatsuo

I have opened #12 to track the attempt at supporting mdb_set_compare and mdb_set_dupsort, at first in a primitive form to be expanded later when support is added to the C API.

bmatsuo avatar Oct 29 '15 01:10 bmatsuo

Re: mdb_set_relfunc/mdb_set_relctx

This feature is not implemented yet in LMDB

Currently the relocation feature is unimplemented and setting this function has no effect.

It looks like its technically possible to bind the API, though. The ctx function would likely have to be co-opted as is done for mdb_reader_list.

Though I don't have a good understanding of when this would be usable or if Go is usable in such environments. And the feature really shouldn't be implemented until there is some understanding of that.

bmatsuo avatar Nov 01 '15 00:11 bmatsuo