api

package
v0.0.0-...-6f2a98a Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(v interface{}, from io.Reader) error

Decode should be used to decode anything sent to or use by the cluster

func Encode

func Encode(v interface{}, to io.Writer) error

Encode should be used to encode anything sent to or use by the cluster

Types

type ClientAction

type ClientAction string

ClientAction is used to route client requests to the appropriate handler

const (
	Get          ClientAction = "get"
	Put          ClientAction = "put"
	Delete       ClientAction = "delete"
	Exists       ClientAction = "exists"
	List         ClientAction = "list"
	DeleteTree   ClientAction = "deleteTree"
	Watch        ClientAction = "watch"
	WatchTree    ClientAction = "watchTree"
	NewLock      ClientAction = "newLock"
	AtomicPut    ClientAction = "atomicPut"
	AtomicDelete ClientAction = "atomicDelete"
)

ClientActions used to handle requests from clients

type Decoder

type Decoder interface {
	Decode(interface{}) error
}

Decoder performs stream decoding of the given value

func NewDecoder

func NewDecoder(from io.Reader) Decoder

NewDecoder returns a Decoder for performing stream decoding from the given reader

type Encoder

type Encoder interface {
	Encode(interface{}) error
}

Encoder performs stream encoding of the given value

func NewEncoder

func NewEncoder(to io.Writer) Encoder

NewEncoder returns an Encoder for performing stream encoding from the given reader

type KVPair

type KVPair struct {
	Key       string
	Value     []byte
	LastIndex uint64
}

KVPair stores the key,value data for use in the Request/Response

type MessageType

type MessageType byte

MessageType is used for routing connections to the appropriate handler

const (
	// RPCMessage is used the MessageType used for none-to-node communication
	RPCMessage MessageType = 10 + iota
	// ClientMessage is the MessageType used for communication from KV clients
	ClientMessage
)

type Request

type Request struct {
	Action   ClientAction
	Key      string
	Value    []byte
	TTL      time.Duration
	Previous *KVPair
	Args     []string
}

Request is used by kv clients when making requests

type Response

type Response struct {
	Err       *errcode.Error
	KV        *KVPair
	List      []*KVPair
	Exists    bool
	Completed bool
}

Response is the response sent to client requests

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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