Documentation
¶
Index ¶
- Constants
- Variables
- func BackupReader(dst string, src io.Reader) error
- func BackupWriter(src string, dst io.Writer) error
- func DisableStrictMode()
- func EnableStrictMode()
- func New(cfg Config) (store.Store, error)
- func PrefixKey(prefix []byte) string
- func ReadTTL(md *nutsdb.MetaData) uint32
- func WatchKey(key []byte) (hash uint64)
- type Config
- type RWMode
- type Store
- func (s *Store) Begin(writable bool) (*nutsdb.Tx, error)
- func (s *Store) Break(ctx context.Context) error
- func (s *Store) Close() error
- func (s *Store) DB() (*nutsdb.DB, error)
- func (s *Store) Del(key []byte) error
- func (s *Store) Get(key []byte) (*store.Value, error)
- func (s *Store) GetNamespace() string
- func (s *Store) Namespace(namespace string) (store.Namespace, error)
- func (s *Store) PrefixScan(prefix []byte, offset, limit int) ([]*store.Value, error)
- func (s *Store) PrefixSearchScan(prefix []byte, reg string, offset, limit int) ([]*store.Value, error)
- func (s *Store) Restore(src io.Reader) (err error)
- func (s *Store) Set(key, value []byte) error
- func (s *Store) SetWithTTL(key, value []byte, ttl uint32) error
- func (s *Store) Snapshot() (io.Reader, error)
- func (s *Store) State() uint32
- func (s *Store) Transaction(writable bool, fn func(tx *nutsdb.Tx) error) error
- func (s *Store) TrySet(key, value []byte) error
- func (s *Store) TrySetWithTTL(key, value []byte, ttl uint32) error
- func (s *Store) Watch(key []byte) (store.WatcherNotify, error)
- func (s *Store) WatchPrefix(prefix []byte) store.WatcherNotify
- type Watcher
- type WatcherChannel
- type WatcherChild
- type WatcherNotify
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 DisableStrictMode ¶
func DisableStrictMode()
func EnableStrictMode ¶
func EnableStrictMode()
func WatchKey ¶
WatchKey from: https://en.wikipedia.org/wiki/Jenkins_hash_function (Jenkins' One-At-A-Time hashing)
Types ¶
type Store ¶ added in v0.7.0
type Store struct {
// contains filtered or unexported fields
}
func (*Store) GetNamespace ¶ added in v0.7.0
func (*Store) PrefixScan ¶ added in v0.7.0
func (*Store) PrefixSearchScan ¶ added in v0.7.0
func (*Store) SetWithTTL ¶ added in v0.7.0
func (*Store) Transaction ¶ added in v0.7.0
func (*Store) TrySetWithTTL ¶ added in v0.7.0
func (*Store) Watch ¶ added in v0.7.0
func (s *Store) Watch(key []byte) (store.WatcherNotify, error)
func (*Store) WatchPrefix ¶ added in v0.7.0
func (s *Store) WatchPrefix(prefix []byte) store.WatcherNotify
type Watcher ¶
func (*Watcher) Namespace ¶
func (w *Watcher) Namespace(namespace string) *WatcherChild
type WatcherChannel ¶
type WatcherChannel struct {
PrefixWatch bool
Seq uint64
LastUpdate int64
Value *[]byte
Prefix []byte
Notify sync.Map // map[string]*WatcherNotify
// contains filtered or unexported fields
}
func (*WatcherChannel) AddNotify ¶
func (c *WatcherChannel) AddNotify(dest *WatcherNotify)
func (*WatcherChannel) UpdateValue ¶
func (c *WatcherChannel) UpdateValue(key []byte, value *[]byte, ttl uint32)
type WatcherChild ¶
type WatcherChild struct {
Namespace string
Channels sync.Map // map[uint64]*WatcherChannel
PrefixChannels sync.Map // map[string]*WatcherChannel
}
func (*WatcherChild) Update ¶
func (c *WatcherChild) Update(key, value []byte, ttl uint32)
func (*WatcherChild) Watch ¶
func (c *WatcherChild) Watch(key []byte) *WatcherNotify
func (*WatcherChild) WatchPrefix ¶ added in v0.5.1
func (c *WatcherChild) WatchPrefix(prefix []byte) *WatcherNotify
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
Click to show internal directories.
Click to hide internal directories.