diff --git a/exp/lmdbsync/lmdbsync.go b/exp/lmdbsync/lmdbsync.go index 5378d56d..39dd61f0 100644 --- a/exp/lmdbsync/lmdbsync.go +++ b/exp/lmdbsync/lmdbsync.go @@ -8,7 +8,7 @@ Bypassing an Env's methods to access the underlying lmdb.Env is not safe. The severity of such usage depends such behavior should be strictly avoided as it may produce undefined behavior from the LMDB C library. -Resizing the environment +# Resizing the environment The Env type synchronizes all calls to Env.SetMapSize so that it may, with some caveats, be safely called in the presence of concurrent transactions after an @@ -65,7 +65,7 @@ not OS X). See mdb_env_set_mapsize. -MapFull +# MapFull The MapFullHandler function configures an Env to automatically call increase the map size with Env.SetMapSize and retry transactions when a lmdb.MapFull @@ -77,7 +77,7 @@ and do not cause unwanted additive change to the program state. See mdb_txn_commit and MDB_MAP_FULL. -MapResized +# MapResized When multiple processes access and resize an environment it is not uncommon to encounter a MapResized error which prevents the TxnOp from being executed and @@ -90,7 +90,7 @@ TxnOp. See mdb_txn_begin and MDB_MAP_RESIZED. -NoLock +# NoLock When the lmdb.NoLock flag is set on an environment Env handles all transaction synchronization using Go structures and is an experimental feature. It is diff --git a/lmdb/error.go b/lmdb/error.go index 8f106a68..86801e8d 100644 --- a/lmdb/error.go +++ b/lmdb/error.go @@ -63,10 +63,10 @@ const ( // Most often helper functions such as IsNotFound may be used instead of // dealing with Errno values directly. // -// lmdb.IsNotFound(err) -// lmdb.IsErrno(err, lmdb.TxnFull) -// lmdb.IsErrnoSys(err, syscall.EINVAL) -// lmdb.IsErrnoFn(err, os.IsPermission) +// lmdb.IsNotFound(err) +// lmdb.IsErrno(err, lmdb.TxnFull) +// lmdb.IsErrnoSys(err, syscall.EINVAL) +// lmdb.IsErrnoFn(err, os.IsPermission) type Errno C.int // minimum and maximum values produced for the Errno type. syscall.Errnos of diff --git a/lmdb/error_unix.go b/lmdb/error_unix.go index 1456ca24..8b624ddc 100644 --- a/lmdb/error_unix.go +++ b/lmdb/error_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package lmdb diff --git a/lmdb/lmdb.go b/lmdb/lmdb.go index 41230717..0239d178 100644 --- a/lmdb/lmdb.go +++ b/lmdb/lmdb.go @@ -8,8 +8,7 @@ reference. http://www.lmdb.tech/doc/starting.html http://www.lmdb.tech/doc/modules.html - -Environment +# Environment An LMDB environment holds named databases (key-value stores). An environment is represented as one file on the filesystem (though often a corresponding lock @@ -25,8 +24,7 @@ Note that the package lmdb forces all Env objects to be opened with the NoTLS (in the author's opinion). However, even for environments opened with this flag there are caveats regarding how transactions are used (see Caveats below). - -Databases +# Databases A database in an LMDB environment is an ordered key-value store that holds arbitrary binary data. Typically the keys are unique but duplicate keys may be @@ -43,8 +41,7 @@ closed but it is not required. Typically, applications acquire handles for all their databases immediately after opening an environment and retain them for the lifetime of the process. - -Transactions +# Transactions View (readonly) transactions in LMDB operate on a snapshot of the database at the time the transaction began. The number of simultaneously active view @@ -108,8 +105,7 @@ uses a finalizer to abort unreachable Txn objects. But of course, applications must still be careful not to leak unterminated Txn objects in a way such that they fail get garbage collected. - -Caveats +# Caveats Write transactions (those created without the Readonly flag) must be created in a goroutine that has been locked to its thread by calling the function diff --git a/lmdb/msgfunc.go b/lmdb/msgfunc.go index 4f861e57..8819e8c7 100644 --- a/lmdb/msgfunc.go +++ b/lmdb/msgfunc.go @@ -37,7 +37,7 @@ type msgfunc func(string) error // not contain pointers in their struct fields. See the following language // proposal which discusses the restrictions on passing pointers to C. // -// https://github.com/golang/proposal/blob/master/design/12416-cgo-pointers.md +// https://github.com/golang/proposal/blob/master/design/12416-cgo-pointers.md type msgctx uintptr type _msgctx struct { fn msgfunc diff --git a/lmdb/val.go b/lmdb/val.go index 9975b2f5..c1423d99 100644 --- a/lmdb/val.go +++ b/lmdb/val.go @@ -19,8 +19,8 @@ import ( // source file malloc.go and the compiler typecheck.go for more information // about memory limits and array bound limits. // -// https://github.com/golang/go/blob/a03bdc3e6bea34abd5077205371e6fb9ef354481/src/runtime/malloc.go#L151-L164 -// https://github.com/golang/go/blob/36a80c5941ec36d9c44d6f3c068d13201e023b5f/src/cmd/compile/internal/gc/typecheck.go#L383 +// https://github.com/golang/go/blob/a03bdc3e6bea34abd5077205371e6fb9ef354481/src/runtime/malloc.go#L151-L164 +// https://github.com/golang/go/blob/36a80c5941ec36d9c44d6f3c068d13201e023b5f/src/cmd/compile/internal/gc/typecheck.go#L383 // // On 64-bit systems, luckily, the value 2^32-1 coincides with the maximum data // size for LMDB (MAXDATASIZE). @@ -42,9 +42,9 @@ type Multi struct { // WrapMulti converts a page of contiguous values with stride size into a // Multi. WrapMulti panics if len(page) is not a multiple of stride. // -// _, val, _ := cursor.Get(nil, nil, lmdb.FirstDup) -// _, page, _ := cursor.Get(nil, nil, lmdb.GetMultiple) -// multi := lmdb.WrapMulti(page, len(val)) +// _, val, _ := cursor.Get(nil, nil, lmdb.FirstDup) +// _, page, _ := cursor.Get(nil, nil, lmdb.GetMultiple) +// multi := lmdb.WrapMulti(page, len(val)) // // See mdb_cursor_get and MDB_GET_MULTIPLE. func WrapMulti(page []byte, stride int) *Multi { @@ -83,8 +83,7 @@ func (m *Multi) Stride() int { // Size returns the total size of the Multi data and is equal to // -// m.Len()*m.Stride() -// +// m.Len()*m.Stride() func (m *Multi) Size() int { return len(m.page) }