etcd

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyPrefix = "/github.com/coreos/agro/"
)

Variables

This section is empty.

Functions

func BytesAddOne

func BytesAddOne(in []byte) ([]byte, interface{}, error)

func BytesToUint64

func BytesToUint64(b []byte) uint64

func DeleteKey

func DeleteKey(key []byte) *etcdpb.DeleteRangeRequest

func GetKey

func GetKey(key []byte) *etcdpb.RangeRequest

func GetPrefix

func GetPrefix(key []byte) *etcdpb.RangeRequest

func KeyEquals

func KeyEquals(key []byte, value []byte) *etcdpb.Compare

func KeyExists

func KeyExists(key []byte) *etcdpb.Compare

func KeyIsVersion

func KeyIsVersion(key []byte, version int64) *etcdpb.Compare

func KeyNotExists

func KeyNotExists(key []byte) *etcdpb.Compare

func MkKey

func MkKey(s ...string) []byte

func SetKey

func SetKey(key []byte, value []byte) *etcdpb.PutRequest

func SetLeasedKey

func SetLeasedKey(lease int64, key []byte, value []byte) *etcdpb.PutRequest

func Uint64ToBytes

func Uint64ToBytes(x uint64) []byte

func Uint64ToHex

func Uint64ToHex(x uint64) string

Types

type AtomicModifyFunc

type AtomicModifyFunc func(in []byte) (out []byte, data interface{}, err error)

AtomicModifyFunc is a class of commutative functions that, given the current state of a key's value `in`, returns the new state of the key `out`, and `data` to be returned to the calling function on success, or an `err`.

This function may be run mulitple times, if the value has changed in the time between getting the data and setting the new value.

type Etcd

type Etcd struct {
	KV etcdpb.KVClient
	// contains filtered or unexported fields
}

func (*Etcd) AtomicModifyKey

func (c *Etcd) AtomicModifyKey(key []byte, f AtomicModifyFunc) (interface{}, error)

func (*Etcd) Close

func (e *Etcd) Close() error

func (*Etcd) CommitINodeIndex

func (c *Etcd) CommitINodeIndex(vid agro.VolumeID) (agro.INodeID, error)

func (*Etcd) DumpMetadata

func (c *Etcd) DumpMetadata(w io.Writer) error

func (*Etcd) GetINodeIndex

func (c *Etcd) GetINodeIndex(vid agro.VolumeID) (agro.INodeID, error)

func (*Etcd) GetLease

func (c *Etcd) GetLease() (int64, error)

func (*Etcd) GetPeers

func (c *Etcd) GetPeers() (agro.PeerInfoList, error)

func (*Etcd) GetRing

func (c *Etcd) GetRing() (agro.Ring, error)

func (*Etcd) GetVolume

func (c *Etcd) GetVolume(volume string) (*models.Volume, error)

func (*Etcd) GetVolumes

func (c *Etcd) GetVolumes() ([]*models.Volume, error)

func (*Etcd) GlobalMetadata

func (c *Etcd) GlobalMetadata() (agro.GlobalMetadata, error)

func (*Etcd) Kind

func (e *Etcd) Kind() agro.MetadataKind

func (*Etcd) NewVolumeID

func (c *Etcd) NewVolumeID() (agro.VolumeID, error)

func (*Etcd) RegisterPeer

func (c *Etcd) RegisterPeer(lease int64, p *models.PeerInfo) error

func (*Etcd) SetRing

func (c *Etcd) SetRing(ring agro.Ring) error

func (*Etcd) SubscribeNewRings

func (e *Etcd) SubscribeNewRings(ch chan agro.Ring)

func (*Etcd) UUID

func (c *Etcd) UUID() string

func (*Etcd) UnsubscribeNewRings

func (e *Etcd) UnsubscribeNewRings(ch chan agro.Ring)

func (*Etcd) WithContext

func (e *Etcd) WithContext(ctx context.Context) agro.MetadataService

type Transact

type Transact struct {
	// contains filtered or unexported fields
}

func Tx

func Tx() *Transact

func (*Transact) Do

func (t *Transact) Do(comps ...interface{}) *Transact

func (*Transact) Else

func (t *Transact) Else(comps ...interface{}) *Transact

func (*Transact) If

func (t *Transact) If(comps ...*etcdpb.Compare) *Transact

func (*Transact) Then

func (t *Transact) Then(comps ...interface{}) *Transact

func (*Transact) Tx

func (t *Transact) Tx() *etcdpb.TxnRequest

Jump to

Keyboard shortcuts

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