cassemdb/

directory
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT

README

cassemdb

provide my RAFT and Repository API and implementation.

.
├── api       export function to other client.
├── app       (domain / infras)
├── domain    (infras)
├── infras    (no package could be imported)

Features

  • distributed system based single-raft.
  • TTL
  • lock operation based distributed system
  • watching mechanism (directory or key)
  • support operations set (key, dir) / unset (key / dir) / get (key) / range (dir)
  • dynamic add or remove node API.

Operations prototype

# set a kv or create a directory
set(key, val, isDir, overwrite, ttl)

# use as lock, presudo code like this:
if err = set(k, v, false, overwrite=false, ttl); err != ErrKeyExists {
    // mean key has been set.
}

# remove a kv or a directory, if target key is not found, no error will returned.
unset(key, isDir)

# get a kv
get(key)

# range a directory, return all key, value and type (kv, dir) of it,
# if dirKey is a kv type, ErrNotDir will be returned, at meantime dir type item has no value
# in result.
range(dirKey)

# only works while target key is a kv type and it's ttl is bigger than 0. 
expire(key)

# shows how long will the key alive.
ttl(key)

Error code

ErrNotFound
ErrNotDir
ErrKeyExists 

Directories

Path Synopsis
infras
raft-leader-grpc
Package raftleader is included in your Raft nodes to expose whether this node is the leader.
Package raftleader is included in your Raft nodes to expose whether this node is the leader.

Jump to

Keyboard shortcuts

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