Documentation
¶
Index ¶
- Constants
- Variables
- type Backend
- type ComponentLabelValue
- type Config
- type Election
- type KVBackedStore
- func (s *KVBackedStore) AtomicPutClusterData(ctx context.Context, cd *cluster.ClusterData, previous *KVPair) (*KVPair, error)
- func (s *KVBackedStore) GetClusterData(ctx context.Context) (*cluster.ClusterData, *KVPair, error)
- func (s *KVBackedStore) GetKeepersInfo(ctx context.Context) (cluster.KeepersInfo, error)
- func (s *KVBackedStore) GetProxiesInfo(ctx context.Context) (cluster.ProxiesInfo, error)
- func (s *KVBackedStore) GetSentinelsInfo(ctx context.Context) (cluster.SentinelsInfo, error)
- func (s *KVBackedStore) PutClusterData(ctx context.Context, cd *cluster.ClusterData) error
- func (s *KVBackedStore) SetKeeperInfo(ctx context.Context, id string, ms *cluster.KeeperInfo, ttl time.Duration) error
- func (s *KVBackedStore) SetProxyInfo(ctx context.Context, pi *cluster.ProxyInfo, ttl time.Duration) error
- func (s *KVBackedStore) SetSentinelInfo(ctx context.Context, si *cluster.SentinelInfo, ttl time.Duration) error
- type KVPair
- type KVStore
- type KubeElection
- type KubeStore
- func (s *KubeStore) AtomicPutClusterData(ctx context.Context, cd *cluster.ClusterData, previous *KVPair) (*KVPair, error)
- func (s *KubeStore) GetClusterData(ctx context.Context) (*cluster.ClusterData, *KVPair, error)
- func (s *KubeStore) GetKeepersInfo(ctx context.Context) (cluster.KeepersInfo, error)
- func (s *KubeStore) GetProxiesInfo(ctx context.Context) (cluster.ProxiesInfo, error)
- func (s *KubeStore) GetSentinelsInfo(ctx context.Context) (cluster.SentinelsInfo, error)
- func (s *KubeStore) PutClusterData(ctx context.Context, cd *cluster.ClusterData) error
- func (s *KubeStore) SetKeeperInfo(ctx context.Context, id string, ms *cluster.KeeperInfo, ttl time.Duration) error
- func (s *KubeStore) SetProxyInfo(ctx context.Context, pi *cluster.ProxyInfo, ttl time.Duration) error
- func (s *KubeStore) SetSentinelInfo(ctx context.Context, si *cluster.SentinelInfo, ttl time.Duration) error
- type Store
- type WriteOptions
Constants ¶
View Source
const ( DefaultEtcdEndpoints = "http://127.0.0.1:2379" DefaultConsulEndpoints = "http://127.0.0.1:8500" )
View Source
const ( //TODO(sgotti) fix this in libkv? // consul min ttl is 10s and libkv divides this by 2 MinTTL = 20 * time.Second )
Variables ¶
View Source
var ( // ErrKeyNotFound is thrown when the key is not found in the store during a Get operation ErrKeyNotFound = errors.New("Key not found in store") ErrKeyModified = errors.New("Unable to complete atomic operation, key modified") ErrElectionNoLeader = errors.New("election: no leader") )
View Source
var URLSchemeRegexp = regexp.MustCompile(`^([a-zA-Z][a-zA-Z0-9+-.]*)://`)
Functions ¶
This section is empty.
Types ¶
type ComponentLabelValue ¶
type ComponentLabelValue string
const ( DefaultComponentLabel = "component" KeeperLabelValue ComponentLabelValue = "stolon-keeper" SentinelLabelValue ComponentLabelValue = "stolon-sentinel" ProxyLabelValue ComponentLabelValue = "stolon-proxy" )
type Election ¶
type Election interface { // TODO(sgotti) this mimics the current docker/leadership API and the etcdv3 // implementations adapt to it. In future it could be replaced with a better // api like the current one implemented by etcdclientv3/concurrency. // // WARNING: If the election error channel receives any error, it is vital that // the consuming code calls election.Stop(). Failure to do so can cause // subsequent elections to hang indefinitely across all participants of an // election. RunForElection() (<-chan bool, <-chan error) Leader() (string, error) Stop() }
type KVBackedStore ¶
type KVBackedStore struct {
// contains filtered or unexported fields
}
func NewKVBackedStore ¶
func NewKVBackedStore(kvStore KVStore, path string) *KVBackedStore
func (*KVBackedStore) AtomicPutClusterData ¶
func (s *KVBackedStore) AtomicPutClusterData(ctx context.Context, cd *cluster.ClusterData, previous *KVPair) (*KVPair, error)
func (*KVBackedStore) GetClusterData ¶
func (s *KVBackedStore) GetClusterData(ctx context.Context) (*cluster.ClusterData, *KVPair, error)
func (*KVBackedStore) GetKeepersInfo ¶
func (s *KVBackedStore) GetKeepersInfo(ctx context.Context) (cluster.KeepersInfo, error)
func (*KVBackedStore) GetProxiesInfo ¶
func (s *KVBackedStore) GetProxiesInfo(ctx context.Context) (cluster.ProxiesInfo, error)
func (*KVBackedStore) GetSentinelsInfo ¶
func (s *KVBackedStore) GetSentinelsInfo(ctx context.Context) (cluster.SentinelsInfo, error)
func (*KVBackedStore) PutClusterData ¶
func (s *KVBackedStore) PutClusterData(ctx context.Context, cd *cluster.ClusterData) error
func (*KVBackedStore) SetKeeperInfo ¶
func (s *KVBackedStore) SetKeeperInfo(ctx context.Context, id string, ms *cluster.KeeperInfo, ttl time.Duration) error
func (*KVBackedStore) SetProxyInfo ¶
func (*KVBackedStore) SetSentinelInfo ¶
func (s *KVBackedStore) SetSentinelInfo(ctx context.Context, si *cluster.SentinelInfo, ttl time.Duration) error
type KVStore ¶
type KVStore interface { // Put a value at the specified key Put(ctx context.Context, key string, value []byte, options *WriteOptions) error // Get a value given its key Get(ctx context.Context, key string) (*KVPair, error) // List the content of a given prefix List(ctx context.Context, directory string) ([]*KVPair, error) // Atomic CAS operation on a single value. // Pass previous = nil to create a new key. AtomicPut(ctx context.Context, key string, value []byte, previous *KVPair, options *WriteOptions) (*KVPair, error) Delete(ctx context.Context, key string) error // Close the store connection Close() error }
func NewKVStore ¶
type KubeElection ¶
type KubeElection struct {
// contains filtered or unexported fields
}
func NewKubeElection ¶
func NewKubeElection(kubecli *kubernetes.Clientset, podName, namespace, clusterName, candidateUID string) (*KubeElection, error)
func (*KubeElection) Leader ¶
func (e *KubeElection) Leader() (string, error)
func (*KubeElection) RunForElection ¶
func (e *KubeElection) RunForElection() (<-chan bool, <-chan error)
func (*KubeElection) Stop ¶
func (e *KubeElection) Stop()
type KubeStore ¶
type KubeStore struct {
// contains filtered or unexported fields
}
func NewKubeStore ¶
func NewKubeStore(kubecli *kubernetes.Clientset, podName, namespace, clusterName string) (*KubeStore, error)
func (*KubeStore) AtomicPutClusterData ¶
func (*KubeStore) GetClusterData ¶
func (*KubeStore) GetKeepersInfo ¶
func (*KubeStore) GetProxiesInfo ¶
func (*KubeStore) GetSentinelsInfo ¶
func (*KubeStore) PutClusterData ¶
func (*KubeStore) SetKeeperInfo ¶
func (*KubeStore) SetProxyInfo ¶
func (*KubeStore) SetSentinelInfo ¶
type Store ¶
type Store interface { AtomicPutClusterData(ctx context.Context, cd *cluster.ClusterData, previous *KVPair) (*KVPair, error) PutClusterData(ctx context.Context, cd *cluster.ClusterData) error GetClusterData(ctx context.Context) (*cluster.ClusterData, *KVPair, error) SetKeeperInfo(ctx context.Context, id string, ms *cluster.KeeperInfo, ttl time.Duration) error GetKeepersInfo(ctx context.Context) (cluster.KeepersInfo, error) SetSentinelInfo(ctx context.Context, si *cluster.SentinelInfo, ttl time.Duration) error GetSentinelsInfo(ctx context.Context) (cluster.SentinelsInfo, error) SetProxyInfo(ctx context.Context, pi *cluster.ProxyInfo, ttl time.Duration) error GetProxiesInfo(ctx context.Context) (cluster.ProxiesInfo, error) }
type WriteOptions ¶
Click to show internal directories.
Click to hide internal directories.