kvstore

package
v0.0.0-...-a5bca4c Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLockPath

func GetLockPath(path string) string

GetLockPath returns the lock path representation of the given path.

Types

type ConsulClient

type ConsulClient struct {
	*consulAPI.Client
}

func (*ConsulClient) DeleteTree

func (c *ConsulClient) DeleteTree(path string) error

func (*ConsulClient) GASNewL3n4AddrID

func (c *ConsulClient) GASNewL3n4AddrID(basePath string, baseID uint32, lAddrID *types.L3n4AddrID) error

func (*ConsulClient) GASNewSecLabelID

func (c *ConsulClient) GASNewSecLabelID(basePath string, baseID uint32, pI *policy.Identity) error

func (*ConsulClient) GetMaxID

func (c *ConsulClient) GetMaxID(key string, firstID uint32) (uint32, error)

GetMaxID returns the maximum possible free UUID stored in consul.

func (*ConsulClient) GetValue

func (c *ConsulClient) GetValue(k string) (json.RawMessage, error)

func (*ConsulClient) GetWatcher

func (c *ConsulClient) GetWatcher(key string, timeSleep time.Duration) <-chan []policy.NumericIdentity

GetWatcher watches for kvstore changes in the given key. Triggers the returned channel every time the key path is changed.

func (*ConsulClient) InitializeFreeID

func (c *ConsulClient) InitializeFreeID(path string, firstID uint32) error

func (*ConsulClient) LockPath

func (c *ConsulClient) LockPath(path string) (KVLocker, error)

func (*ConsulClient) SetMaxID

func (c *ConsulClient) SetMaxID(key string, firstID, maxID uint32) error

func (*ConsulClient) SetValue

func (c *ConsulClient) SetValue(k string, v interface{}) error

func (*ConsulClient) Status

func (c *ConsulClient) Status() (string, error)

type EtcdClient

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

func (*EtcdClient) DeleteTree

func (e *EtcdClient) DeleteTree(path string) error

func (*EtcdClient) GASNewL3n4AddrID

func (e *EtcdClient) GASNewL3n4AddrID(basePath string, baseID uint32, lAddrID *types.L3n4AddrID) error

GASNewL3n4AddrID gets the next available ServiceID and sets it in lAddrID. After assigning the ServiceID to lAddrID it sets the ServiceID + 1 in common.LastFreeServiceIDKeyPath path.

func (*EtcdClient) GASNewSecLabelID

func (e *EtcdClient) GASNewSecLabelID(basePath string, baseID uint32, pI *policy.Identity) error

GASNewSecLabelID gets the next available LabelID and sets it in id. After assigning the LabelID to id it sets the LabelID + 1 in common.LastFreeLabelIDKeyPath path.

func (*EtcdClient) GetMaxID

func (e *EtcdClient) GetMaxID(key string, firstID uint32) (uint32, error)

func (*EtcdClient) GetValue

func (e *EtcdClient) GetValue(k string) (json.RawMessage, error)

func (*EtcdClient) GetWatcher

func (e *EtcdClient) GetWatcher(key string, timeSleep time.Duration) <-chan []policy.NumericIdentity

GetWatcher watches for kvstore changes in the given key. Triggers the returned channel every time the key path is changed.

func (*EtcdClient) InitializeFreeID

func (e *EtcdClient) InitializeFreeID(path string, firstID uint32) error

func (*EtcdClient) LockPath

func (e *EtcdClient) LockPath(path string) (KVLocker, error)

func (*EtcdClient) SetMaxID

func (e *EtcdClient) SetMaxID(key string, firstID, maxID uint32) error

func (*EtcdClient) SetValue

func (e *EtcdClient) SetValue(k string, v interface{}) error

func (*EtcdClient) Status

func (e *EtcdClient) Status() (string, error)

type EtcdLocker

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

func (*EtcdLocker) Unlock

func (e *EtcdLocker) Unlock() error

type KVClient

type KVClient interface {
	LockPath(path string) (KVLocker, error)
	GetValue(k string) (json.RawMessage, error)
	SetValue(k string, v interface{}) error
	InitializeFreeID(path string, firstID uint32) error
	GetMaxID(key string, firstID uint32) (uint32, error)
	SetMaxID(key string, firstID, maxID uint32) error

	GASNewSecLabelID(baseKeyPath string, baseID uint32, secCtxLabels *policy.Identity) error
	GASNewL3n4AddrID(basePath string, baseID uint32, lAddrID *types.L3n4AddrID) error

	DeleteTree(path string) error

	GetWatcher(key string, timeSleep time.Duration) <-chan []policy.NumericIdentity

	Status() (string, error)
}

func NewConsulClient

func NewConsulClient(config *consulAPI.Config) (KVClient, error)

func NewEtcdClient

func NewEtcdClient(config *client.Config, cfgPath string) (KVClient, error)

func NewLocalClient

func NewLocalClient() KVClient

type KVLocker

type KVLocker interface {
	Unlock() error
}

type LocalClient

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

func (*LocalClient) DeleteTree

func (l *LocalClient) DeleteTree(path string) error

func (*LocalClient) GASNewL3n4AddrID

func (l *LocalClient) GASNewL3n4AddrID(basePath string, baseID uint32, lAddrID *types.L3n4AddrID) error

func (*LocalClient) GASNewSecLabelID

func (l *LocalClient) GASNewSecLabelID(basePath string, baseID uint32, pI *policy.Identity) error

func (*LocalClient) GetMaxID

func (l *LocalClient) GetMaxID(key string, firstID uint32) (uint32, error)

func (*LocalClient) GetValue

func (l *LocalClient) GetValue(k string) (json.RawMessage, error)

func (*LocalClient) GetWatcher

func (l *LocalClient) GetWatcher(key string, timeSleep time.Duration) <-chan []policy.NumericIdentity

func (*LocalClient) InitializeFreeID

func (l *LocalClient) InitializeFreeID(path string, firstID uint32) error

func (*LocalClient) LockPath

func (l *LocalClient) LockPath(path string) (KVLocker, error)

func (*LocalClient) SetMaxID

func (l *LocalClient) SetMaxID(key string, firstID, maxID uint32) error

func (*LocalClient) SetValue

func (l *LocalClient) SetValue(k string, v interface{}) error

func (*LocalClient) Status

func (e *LocalClient) Status() (string, error)

type LocalLocker

type LocalLocker struct {
}

func (*LocalLocker) Unlock

func (l *LocalLocker) Unlock() error

Jump to

Keyboard shortcuts

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