nuts

package
v0.3.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateOk uint32 = iota
	StateBreak
)
View Source
const (
	// FileIO represents the read and write mode using standard I/O.
	FileIO = nutsdb.FileIO

	// MMap represents the read and write mode using mmap.
	MMap = nutsdb.MMap
)
View Source
const WatcherNotifyValueSize = 1024

Variables

View Source
var (
	ErrStateBreak = errors.New("state break")
)

Functions

func BackupReader

func BackupReader(dst string, src io.Reader) error

func DisableStrictMode

func DisableStrictMode()

func EnableStrictMode

func EnableStrictMode()

func New

func New(cfg Config) (store.Store, error)

func WatchKey

func WatchKey(key []byte) (hash uint64)

WatchKey from: https://en.wikipedia.org/wiki/Jenkins_hash_function (Jenkins' One-At-A-Time hashing)

Types

type Config

type Config struct {
	NodeNum int64
	Sync    bool
	DataDir string
	RWMode  RWMode
}

type RWMode

type RWMode = nutsdb.RWMode

RWMode represents the read and write mode.

type Watcher

type Watcher struct {
	Namespaces sync.Map // map[string]*WatcherChild
}

func (*Watcher) Get

func (w *Watcher) Get() *WatcherMetadata

func (*Watcher) Namespace

func (w *Watcher) Namespace(namespace string) *WatcherChild

type WatcherChannel

type WatcherChannel struct {
	Seq        uint64
	LastUpdate int64
	Value      *[]byte
	Notify     sync.Map // map[string]*WatcherNotify
	// contains filtered or unexported fields
}

func (*WatcherChannel) AddNotify

func (c *WatcherChannel) AddNotify(dest *WatcherNotify)

func (*WatcherChannel) Get

func (c *WatcherChannel) Get() map[string]int

func (*WatcherChannel) UpdateValue

func (c *WatcherChannel) UpdateValue(val *[]byte)

type WatcherChild

type WatcherChild struct {
	Namespace string
	Channels  sync.Map // map[uint64]*WatcherChannel
}

func (*WatcherChild) Get

func (c *WatcherChild) Get() map[uint64]map[string]int

func (*WatcherChild) Update

func (c *WatcherChild) Update(key, value []byte)

func (*WatcherChild) Watch

func (c *WatcherChild) Watch(key []byte) *WatcherNotify

type WatcherMetadata

type WatcherMetadata map[string]map[uint64]map[string]int

func (*WatcherMetadata) String

func (m *WatcherMetadata) String() string

type WatcherNotify

type WatcherNotify struct {
	Values chan *store.WatchValue
	UUID   string
	// contains filtered or unexported fields
}

func (*WatcherNotify) Close

func (n *WatcherNotify) Close() error

func (*WatcherNotify) Notify

func (n *WatcherNotify) Notify() chan *store.WatchValue

Jump to

Keyboard shortcuts

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