etcd: Index | Files

package v2store

import ""

Package v2store defines etcd's in-memory key/value store in v2 API. To be deprecated in favor of v3 storage.


Package Files

doc.go event.go event_history.go event_queue.go metrics.go node.go node_extern.go stats.go store.go ttl_key_heap.go watcher.go watcher_hub.go


const (
    Get              = "get"
    Create           = "create"
    Set              = "set"
    Update           = "update"
    Delete           = "delete"
    CompareAndSwap   = "compareAndSwap"
    CompareAndDelete = "compareAndDelete"
    Expire           = "expire"
const (
    CompareMatch = iota

explanations of Compare function result

const (
    SetSuccess = iota
const (
    GetRecursive = "getRecursive"


var Permanent time.Time

type Event Uses

type Event struct {
    Action    string      `json:"action"`
    Node      *NodeExtern `json:"node,omitempty"`
    PrevNode  *NodeExtern `json:"prevNode,omitempty"`
    EtcdIndex uint64      `json:"-"`
    Refresh   bool        `json:"refresh,omitempty"`

func (*Event) Clone Uses

func (e *Event) Clone() *Event

func (*Event) Index Uses

func (e *Event) Index() uint64

func (*Event) IsCreated Uses

func (e *Event) IsCreated() bool

func (*Event) SetRefresh Uses

func (e *Event) SetRefresh()

type EventHistory Uses

type EventHistory struct {
    Queue      eventQueue
    StartIndex uint64
    LastIndex  uint64
    // contains filtered or unexported fields

type NodeExtern Uses

type NodeExtern struct {
    Key           string      `json:"key,omitempty"`
    Value         *string     `json:"value,omitempty"`
    Dir           bool        `json:"dir,omitempty"`
    Expiration    *time.Time  `json:"expiration,omitempty"`
    TTL           int64       `json:"ttl,omitempty"`
    Nodes         NodeExterns `json:"nodes,omitempty"`
    ModifiedIndex uint64      `json:"modifiedIndex,omitempty"`
    CreatedIndex  uint64      `json:"createdIndex,omitempty"`

NodeExtern is the external representation of the internal node with additional fields PrevValue is the previous value of the node TTL is time to live in second

func (*NodeExtern) Clone Uses

func (eNode *NodeExtern) Clone() *NodeExtern

type NodeExterns Uses

type NodeExterns []*NodeExtern

func (NodeExterns) Len Uses

func (ns NodeExterns) Len() int

func (NodeExterns) Less Uses

func (ns NodeExterns) Less(i, j int) bool

func (NodeExterns) Swap Uses

func (ns NodeExterns) Swap(i, j int)

type Stats Uses

type Stats struct {
    GetSuccess uint64 `json:"getsSuccess"`
    GetFail    uint64 `json:"getsFail"`

    SetSuccess uint64 `json:"setsSuccess"`
    SetFail    uint64 `json:"setsFail"`

    DeleteSuccess uint64 `json:"deleteSuccess"`
    DeleteFail    uint64 `json:"deleteFail"`

    UpdateSuccess uint64 `json:"updateSuccess"`
    UpdateFail    uint64 `json:"updateFail"`

    CreateSuccess uint64 `json:"createSuccess"`
    CreateFail    uint64 `json:"createFail"`

    CompareAndSwapSuccess uint64 `json:"compareAndSwapSuccess"`
    CompareAndSwapFail    uint64 `json:"compareAndSwapFail"`

    CompareAndDeleteSuccess uint64 `json:"compareAndDeleteSuccess"`
    CompareAndDeleteFail    uint64 `json:"compareAndDeleteFail"`

    ExpireCount uint64 `json:"expireCount"`

    Watchers uint64 `json:"watchers"`

func (*Stats) Inc Uses

func (s *Stats) Inc(field int)

type Store Uses

type Store interface {
    Version() int
    Index() uint64

    Get(nodePath string, recursive, sorted bool) (*Event, error)
    Set(nodePath string, dir bool, value string, expireOpts TTLOptionSet) (*Event, error)
    Update(nodePath string, newValue string, expireOpts TTLOptionSet) (*Event, error)
    Create(nodePath string, dir bool, value string, unique bool,
        expireOpts TTLOptionSet) (*Event, error)
    CompareAndSwap(nodePath string, prevValue string, prevIndex uint64,
        value string, expireOpts TTLOptionSet) (*Event, error)
    Delete(nodePath string, dir, recursive bool) (*Event, error)
    CompareAndDelete(nodePath string, prevValue string, prevIndex uint64) (*Event, error)

    Watch(prefix string, recursive, stream bool, sinceIndex uint64) (Watcher, error)

    Save() ([]byte, error)
    Recovery(state []byte) error

    Clone() Store
    SaveNoCopy() ([]byte, error)

    JsonStats() []byte
    DeleteExpiredKeys(cutoff time.Time)

    HasTTLKeys() bool

func New Uses

func New(namespaces ...string) Store

New creates a store where the given namespaces will be created as initial directories.

type TTLOptionSet Uses

type TTLOptionSet struct {
    ExpireTime time.Time
    Refresh    bool

type Watcher Uses

type Watcher interface {
    EventChan() chan *Event
    StartIndex() uint64 // The EtcdIndex at which the Watcher was created

func NewNopWatcher Uses

func NewNopWatcher() Watcher

Package v2store imports 15 packages (graph) and is imported by 144 packages. Updated 2020-06-19. Refresh now. Tools for package owners.