map32

package
v0.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher func(key uint32, cap int) (offset int)

Hasher calculates the sharding offset.

type Map32

type Map32 interface {
	// Destroy destroy current map.
	Destroy()
	// Range visits all items.
	Range(fn func(uint32, interface{}) bool)
	// Load loads the value of key.
	Load(key uint32) (v interface{}, ok bool)
	// Store stores the key and value.
	Store(key uint32, value interface{})
	// Delete deletes the key.
	Delete(key uint32)
}

Map32 is a safe map for uint32 key.

func New

func New(options ...Option) Map32

New creates a new Map32 with input options.

type Option

type Option func(*config)

Option configs the Map32.

func WithCap

func WithCap(cap int) Option

WithCap sets cap for Map32.

func WithHasher

func WithHasher(h Hasher) Option

WithHasher sets Hasher for Map32.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL