Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define IntegerKey and IntegerDup flags #12

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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