services

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValue

type KeyValue struct {
	// key is the key in bytes. An empty key is not allowed.
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// create_revision is the revision of last creation on this key.
	CreateRevision int64 `protobuf:"varint,2,opt,name=create_revision,json=createRevision,proto3" json:"create_revision,omitempty"`
	// mod_revision is the revision of last modification on this key.
	ModRevision int64 `protobuf:"varint,3,opt,name=mod_revision,json=modRevision,proto3" json:"mod_revision,omitempty"`
	// version is the version of the key. A deletion resets
	// the version to zero and any modification of the key
	// increases its version.
	Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
	// value is the value held by the key, in bytes.
	Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
	// lease is the ID of the lease that attached to key.
	// When the attached lease expires, the key will be deleted.
	// If lease is 0, then no lease is attached to the key.
	Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"`
}

type Node

type Node struct {
	RootPath string
	Nodes    map[string]*Node
	KV       *KeyValue
}

func (*Node) AddLeaf

func (n *Node) AddLeaf(kv *KeyValue)

type Store

type Store struct {
	Client *clientv3.Client
}

func New

func New(endpoints string, ca string, key string, cert string) (*Store, error)

func NewWithOutTLS

func NewWithOutTLS(endpoints string) (*Store, error)

func (*Store) Delete

func (store *Store) Delete(key string) error

func (*Store) List

func (store *Store) List(key string) []*KeyValue

func (*Store) ListByPath

func (store *Store) ListByPath(key string) *Tree

func (*Store) Put

func (store *Store) Put(key string, value string) error

type Tree

type Tree struct {
	Nodes map[string]*Node
}

func (*Tree) AddNode

func (t *Tree) AddNode(kv *KeyValue)

Jump to

Keyboard shortcuts

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