Skip to content

Commit

Permalink
Merge pull request bmatsuo#12 from wojas/define-integerkey-flags
Browse files Browse the repository at this point in the history
Define IntegerKey and IntegerDup flags
  • Loading branch information
wojas committed Feb 22, 2022
2 parents 135c7d5 + 15a56e1 commit 41b4826
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lmdb/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ import (

// This flags are used exclusively for Txn.OpenDBI and Txn.OpenRoot. The
// Create flag must always be supplied when opening a non-root DBI for the
// first time.
//
// BUG(bmatsuo):
// MDB_INTEGERKEY and MDB_INTEGERDUP aren't usable. I'm not sure they would be
// faster with the cgo bridge. They need to be tested and benchmarked.
// first time. When a DBI is created, the other flags will be persisted in the
// LMDB and automatically applied when opening the DBI.
const (
// Flags for Txn.OpenDBI.

Expand All @@ -29,6 +26,14 @@ const (
DupFixed = C.MDB_DUPFIXED // Duplicate items have a fixed size (DupSort).
ReverseDup = C.MDB_REVERSEDUP // Reverse duplicate values (DupSort).
Create = C.MDB_CREATE // Create DB if not already existing.

// IntegerKey and IntegerDup should only be used when needed for
// compatibility with other programs that require them. The keys will be
// interpreted as in-memory integers and sorted according to the endianness
// of the system. The keys returned by the API calls will still be
// []byte slices.
IntegerKey = C.MDB_INTEGERKEY // Use native integer order.
IntegerDup = C.MDB_INTEGERDUP // Duplicate integers (DupSort).
)

// Txn is a database transaction in an environment.
Expand Down

0 comments on commit 41b4826

Please sign in to comment.