Documentation
¶
Overview ¶
Package provider contains the storage provider implementation for Kubernetes.
Package provider contains the storage provider implementation for Kubernetes.
Index ¶
- Constants
- func HashID(id string) string
- type Consensus
- func (c *Consensus) AddObserver(ctx context.Context, peer types.StoragePeer) error
- func (c *Consensus) AddVoter(ctx context.Context, peer types.StoragePeer) error
- func (c *Consensus) DemoteVoter(ctx context.Context, peer types.StoragePeer) error
- func (c *Consensus) GetLeader(ctx context.Context) (types.StoragePeer, error)
- func (c *Consensus) GetPeer(ctx context.Context, id string) (types.StoragePeer, error)
- func (c *Consensus) GetPeers(ctx context.Context) ([]types.StoragePeer, error)
- func (c *Consensus) IsLeader() bool
- func (c *Consensus) IsMember() bool
- func (c *Consensus) RemovePeer(ctx context.Context, peer types.StoragePeer, wait bool) error
- func (c *Consensus) StepDown(ctx context.Context) error
- type DataItem
- type Options
- type Provider
- func (p *Provider) Bootstrap(ctx context.Context) error
- func (p *Provider) Close() error
- func (p *Provider) Consensus() storage.Consensus
- func (p *Provider) Datastore() *database.Database
- func (p *Provider) Eventf(obj runtime.Object, eventType, reason, message string, args ...interface{})
- func (p *Provider) ListenPort() uint16
- func (p *Provider) MeshDB() storage.MeshDB
- func (p *Provider) MeshStorage() storage.MeshStorage
- func (p *Provider) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (p *Provider) RunLeaderElection(ctx context.Context)
- func (p *Provider) Start(ctx context.Context) error
- func (p *Provider) StartManaged(ctx context.Context) error
- func (p *Provider) StartUnmanaged(ctx context.Context) error
- func (p *Provider) Status() *v1.StorageStatus
- func (p *Provider) WaitForCacheSync(ctx context.Context) bool
- type Storage
- func (st *Storage) Delete(ctx context.Context, key []byte) error
- func (st *Storage) GetValue(ctx context.Context, key []byte) ([]byte, error)
- func (st *Storage) IterPrefix(ctx context.Context, prefix []byte, fn storage.PrefixIterator) error
- func (st *Storage) ListKeys(ctx context.Context, prefix []byte) ([][]byte, error)
- func (st *Storage) PutValue(ctx context.Context, key, value []byte, ttl time.Duration) error
- func (st *Storage) Subscribe(ctx context.Context, prefix []byte, fn storage.KVSubscribeFunc) (context.CancelFunc, error)
- type Subscription
Constants ¶
const ( // MeshStorageLabel is the label used to identify all mesh storage secrets. MeshStorageLabel = "webmesh.io/storage" // BucketLabel is the label used to identify the bucket for a given key. BucketLabel = "webmesh.io/storage-bucket" // StorageTraceVLevel is the log level for storage trace logs. StorageTraceVLevel = 2 )
const (
// ConsensusTraceVLevel is the trace level for the consensus package.
ConsensusTraceVLevel = 2
)
const (
// LeaderElectionID is the name of the leader election lease.
LeaderElectionID = "storage-provider-k8s-leader-election"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Consensus ¶
type Consensus struct {
// contains filtered or unexported fields
}
Consensus is the consensus interface for the storage provider.
func (*Consensus) AddObserver ¶
AddObserver adds an observer to the consensus group.
func (*Consensus) DemoteVoter ¶
DemoteVoter demotes a voter to an observer.
func (*Consensus) RemovePeer ¶
RemovePeer removes a peer from the consensus group.
type DataItem ¶
DataItem is a single item of data.
type Options ¶
type Options struct { // NodeID is the ID of the node. NodeID string // ListenPort is the port the storage API is listening on, if any. ListenPort int // MetricsPort is the address to bind the metrics endpoint to. MetricsPort int // ProbePort is the address to bind the health probe endpoint to. ProbePort int // ShutdownTimeout is the timeout for shutting down the provider. ShutdownTimeout time.Duration // Namespace is the namespace to use for leader election and storage. Namespace string // LeaderElectionLeaseDuration is the duration of the leader election lease. LeaderElectionLeaseDuration time.Duration // LeaderElectionRenewDeadline is the duration of the leader election lease renewal deadline. LeaderElectionRenewDeadline time.Duration // LeaderElectionRetryPeriod is the duration of the leader election lease retry period. LeaderElectionRetryPeriod time.Duration // DisableCache disables the cache. DisableCache bool }
Options are the options for configuring the provider.
type Provider ¶
type Provider struct { Options // contains filtered or unexported fields }
Provider is the storage provider implementation for Kubernetes.
func NewObserverWithConfig ¶ added in v0.2.3
NewObserverWithConfig creates a new observing storage provider with the given rest config. An observing storage provider can still write to storage depending on the given configuration, but it will not be able to mutate or participate in consensus.
func NewObserverWithManager ¶ added in v0.2.3
NewObserverWithManager creates an observing storage provider with the given manager.
func NewWithManager ¶
NewWithManager creates a new Provider with the given manager.
func (*Provider) Datastore ¶ added in v0.1.3
Datastore returns the underlying datastore instance. This is useful for embedding the provider in other components.
func (*Provider) Eventf ¶
func (p *Provider) Eventf(obj runtime.Object, eventType, reason, message string, args ...interface{})
Eventf implements the resource recorder and is used to track changes to the leader election lease.
func (*Provider) ListenPort ¶
ListenPort should return the TCP port that the storage provider is listening on.
func (*Provider) MeshDB ¶
MeshDB returns the underlying MeshDB instance. The provider does not need to guarantee consistency on read operations.
func (*Provider) MeshStorage ¶
func (p *Provider) MeshStorage() storage.MeshStorage
MeshStorage returns the underlying MeshStorage instance. The provider does not need to guarantee consistency on read operations.
func (*Provider) Reconcile ¶
Reconcile reconciles the given request. This is used to notify subscribers of changes to the given object.
func (*Provider) RunLeaderElection ¶
RunLeaderElection runs the leader election loop.
func (*Provider) StartManaged ¶
StartUnmanaged starts the provider assuming it controls the controller manager.
func (*Provider) StartUnmanaged ¶
StartUnmanaged starts the provider assuming it does not control the controller manager.
func (*Provider) Status ¶
func (p *Provider) Status() *v1.StorageStatus
Status returns the status of the storage provider.
type Storage ¶
type Storage struct { *Provider // contains filtered or unexported fields }
Storage is the storage interface for the storage provider.
func (*Storage) IterPrefix ¶
IterPrefix iterates over all keys with a given prefix. It is important that the iterator not attempt any write operations as this will cause a deadlock. The iteration will stop if the iterator returns an error.
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Directories
¶
Path | Synopsis |
---|---|
Package database implements a MeshDB using Kubernetes custom resources.
|
Package database implements a MeshDB using Kubernetes custom resources. |
Package manager contains the controller-runtime manager.
|
Package manager contains the controller-runtime manager. |