Documentation ¶
Overview ¶
Package teocdb (teo-cdb) is the Teonet key-value database service package
Install this go package:
go get github.com/kirill-scherba/teonet-go/services/teocdb
Data base organisation ¶
This service uses ScyllaDB. If you install this service manually you need install ScyllaDB. Run Scylla in Docker:
https://www.scylladb.com/download/open-source/#docker
You may check version of your existing running scylla docker container with command:
docker exec -it scylla scylla --version
Before you execute application which used this package you need install database schemas. Launch `cqlsh`:
docker exec -it scylla cqlsh
and execute next commands:
create keyspace teocdb with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 }; create table teocdb.map(key text, data blob, PRIMARY KEY(key)); create table teocdb.ids(id_name text, next_id int, PRIMARY KEY(id_name)); create table teocdb.queue(key text, time timestamp, random UUID, lock text, data blob, PRIMARY KEY(key, time, random));
Index ¶
- Variables
- type Process
- func (p *Process) CmdBinary(pac teoapi.Packet) (err error)
- func (p *Process) CmdDelete(pac teoapi.Packet) (err error)
- func (p *Process) CmdDeleteID(pac teoapi.Packet) (err error)
- func (p *Process) CmdFunc(pac teoapi.Packet) (err error)
- func (p *Process) CmdGet(pac teoapi.Packet) (err error)
- func (p *Process) CmdGetID(pac teoapi.Packet) (err error)
- func (p *Process) CmdGetQueue(pac teoapi.Packet) (err error)
- func (p *Process) CmdList(pac teoapi.Packet) (err error)
- func (p *Process) CmdListBody(pac teoapi.Packet) (err error)
- func (p *Process) CmdSet(pac teoapi.Packet) (err error)
- func (p *Process) CmdSetID(pac teoapi.Packet) (err error)
- func (p *Process) CmdSetQueue(pac teoapi.Packet) (err error)
- type Teocdb
- func (tcdb *Teocdb) Close()
- func (tcdb *Teocdb) Delete(key string) (err error)
- func (tcdb *Teocdb) DeleteID(key string) (err error)
- func (tcdb *Teocdb) Func(key string, value []byte) (data []byte, err error)
- func (tcdb *Teocdb) Get(key string) (data []byte, err error)
- func (tcdb *Teocdb) GetID(key string) (data []byte, err error)
- func (tcdb *Teocdb) GetQueue(key string) (data []byte, err error)
- func (tcdb *Teocdb) List(key string) (keyList cdb.KeyList, err error)
- func (tcdb *Teocdb) ListBody(key string) (dataList []string, err error)
- func (tcdb *Teocdb) PluginFunc(fff string, value []byte) (data []byte, err error)
- func (tcdb *Teocdb) Set(key string, value []byte) (err error)
- func (tcdb *Teocdb) SetID(key string, value []byte) (err error)
- func (tcdb *Teocdb) SetQueue(key string, value []byte) (err error)
Constants ¶
This section is empty.
Variables ¶
var HostsDefault = []string{
"172.17.0.2", "172.17.0.3", "172.17.0.4",
"172.18.0.2", "172.18.0.3", "172.18.0.4",
}
HostsDefault is default hosts IPs
var KeyspaceDefault = "teocdb"
KeyspaceDefault is default keyspace bane
Functions ¶
This section is empty.
Types ¶
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process receiver to process teocdb commands
func (*Process) CmdDeleteID ¶
CmdDeleteID process CmdDeleteID command
func (*Process) CmdGetQueue ¶
CmdGetQueue process CmdGetUeue command; get value from queue
func (*Process) CmdListBody ¶
CmdListBody process CmdListBody command
type Teocdb ¶
type Teocdb struct { *Process // contains filtered or unexported fields }
Teocdb is teocdb packet receiver
func Connect ¶
func Connect(con cdb.TeoConnector, keyAndHosts ...string) (tcdb *Teocdb, err error)
Connect to the cql cluster and return teocdb receiver
func (*Teocdb) PluginFunc ¶
PluginFunc process plugin function: plugin_name.func(parameters ...string)