Documentation
¶
Overview ¶
Package bufmap implements a write-only multi-reader, single-writer map of byte buffers offering wait-free reads and consistent writes. The map consists of a fixed number of slots which are assigned to keys using linear probing. Reads and writes to the data held in a slot are guarded by a seqlock.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidKey = errors.New("invalid key: 0") ErrOutOfSlots = errors.New("out of slots") )
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a write-only lock free map. Its implementation is simplified by not supplying a way of deleting keys. It is also a fixed size. Keys are assigned using linear probing.
func (*Map) Get ¶
Get atomically reads a buffer value stored against key k into buffer buf. The return value will be false if the key could not be found in the map.
func (*Map) Update ¶
Update finds the buffer stored against key k and atomically updates it with v using the function fn. It returns the error returned by fn, if any. It will also return an error if the map is full. The function fn may be called multiple times during a single call to Update, or not called at all if the map cannot find space for the key.