etcd

package
v0.0.0-...-71dce46 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyPrefix = "/github.com/alternative-storage/torus/"
)

Variables

This section is empty.

Functions

func BytesAddOne

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

func BytesToUint64

func BytesToUint64(b []byte) uint64

func MkKey

func MkKey(s ...string) string

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 multiple times, if the value has changed in the time between getting the data and setting the new value.

type Etcd

type Etcd struct {
	Client *etcdv3.Client
	// contains filtered or unexported fields
}

func (*Etcd) AtomicModifyKey

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

TODO(barakmich): Perhaps make this an etcd client library function.

func (*Etcd) Close

func (e *Etcd) Close() error

func (*Etcd) CommitINodeIndex

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

func (*Etcd) DumpMetadata

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

func (*Etcd) GetINodeIndex

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

func (*Etcd) GetLease

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

func (*Etcd) GetLockStatus

func (c *Etcd) GetLockStatus(vid uint64) string

func (*Etcd) GetPeers

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

func (*Etcd) GetRing

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

func (*Etcd) GetVolume

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

func (*Etcd) GetVolumes

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

func (*Etcd) GlobalMetadata

func (c *Etcd) GlobalMetadata() torus.GlobalMetadata

func (*Etcd) Kind

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

func (*Etcd) NewVolumeID

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

func (*Etcd) RegisterPeer

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

func (*Etcd) RenewLease

func (c *Etcd) RenewLease(lease int64) error

func (*Etcd) SetRing

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

func (*Etcd) SubscribeNewRings

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

func (*Etcd) UUID

func (c *Etcd) UUID() string

func (*Etcd) UnsubscribeNewRings

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

func (*Etcd) WithContext

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

Jump to

Keyboard shortcuts

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