Documentation ¶
Overview ¶
Package maxidmmap provides a type for working with atomically unique prompting-related IDs, backed by a memory mapped file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrMaxIDMmapClosed = fmt.Errorf("cannot compute next ID on max ID mmap which has already been closed")
)
Functions ¶
This section is empty.
Types ¶
type MaxIDMmap ¶
type MaxIDMmap []byte
MaxIDMmap is a wrapper for ID tracked backed by a mmap'ed file.
func OpenMaxIDMmap ¶
OpenMaxIDMmap opens and mmaps the given maxIDFilepath, returning the corresponding MaxIDMmap.
If the maxIDFilepath does not exist, or if the file is malformed, it is reset to an 8-byte file with a max ID of 0. If the file cannot be created, opened, or mmaped, returns an error and a nil MaxIDMmap.
func (*MaxIDMmap) Close ¶
Close unmaps the underlying byte slice corresponding to the receiving max ID mmap, if it has not already been unmapped.
The caller must ensure that any relevant lock is held.