client

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2011 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Valid = 1 << iota
	Done
)

Variables

View Source
var (
	ErrNotDir      = &ResponseError{proto.Response_NOTDIR, "not a directory"}
	ErrIsDir       = &ResponseError{proto.Response_ISDIR, "is a directory"}
	ErrCasMismatch = &ResponseError{proto.Response_CAS_MISMATCH, "cas mismatch"}
	ErrInvalidSnap = &ResponseError{proto.Response_INVALID_SNAP, "invalid snapshot id"}
)

Response errors

View Source
var (
	ErrNoAddrs = os.NewError("no known address")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Name string

	Len chan int
	// contains filtered or unexported fields
}

func New

func New(name, addr string) *Client

Name is the name of this cluster. Addr is an initial (writable) address to connect to.

func (*Client) Checkin

func (cl *Client) Checkin(id string, cas int64) (int64, os.Error)

func (*Client) Del

func (cl *Client) Del(path string, cas int64) os.Error

func (*Client) DelSnap

func (cl *Client) DelSnap(id int32) os.Error

func (*Client) Get

func (cl *Client) Get(path string, snapId int32) (body []byte, cas int64, err os.Error)

Returns the body and CAS token of the file at path. If snapId is 0, uses the current state, otherwise, snapId must be a value previously returned from Snap. If path does not denote a file, returns an error.

func (*Client) Getdir

func (cl *Client) Getdir(path string, offset, limit, snapId int32) (*Watch, os.Error)

func (*Client) Join

func (cl *Client) Join(id, addr string) (seqn int64, snapshot string, err os.Error)

func (*Client) Noop

func (cl *Client) Noop() os.Error

func (*Client) Set

func (cl *Client) Set(path string, oldCas int64, body []byte) (newCas int64, err os.Error)

func (*Client) Snap

func (cl *Client) Snap() (id int32, ver int64, err os.Error)

func (*Client) Stat

func (cl *Client) Stat(path string, snapId int32) (int32, int64, os.Error)

func (*Client) Walk

func (cl *Client) Walk(glob string, snapId int32) (*Watch, os.Error)

func (*Client) Watch

func (cl *Client) Watch(glob string) (*Watch, os.Error)

type Event

type Event struct {
	Cas  int64
	Path string
	Body []byte
	Err  os.Error
}

type R

type R proto.Response

func (*R) String

func (r *R) String() string

type ResponseError

type ResponseError struct {
	Code   int32
	Detail string
}

func (*ResponseError) String

func (r *ResponseError) String() string

type T

type T proto.Request

type Watch

type Watch struct {
	C <-chan *Event // to caller
	// contains filtered or unexported fields
}

func (*Watch) Cancel

func (w *Watch) Cancel() os.Error

Jump to

Keyboard shortcuts

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