Documentation ¶
Overview ¶
Package passthrough provides a passthrough storage provider. This is intended to be used by nodes that don't host their own storage, but need to query the storage of other nodes.
Index ¶
- type Consensus
- func (p *Consensus) AddObserver(context.Context, *v1.StoragePeer) error
- func (p *Consensus) AddVoter(context.Context, *v1.StoragePeer) error
- func (p *Consensus) DemoteVoter(context.Context, *v1.StoragePeer) error
- func (p *Consensus) GetLeader(context.Context) (*v1.StoragePeer, error)
- func (p *Consensus) GetPeers(context.Context) ([]*v1.StoragePeer, error)
- func (p *Consensus) IsLeader() bool
- func (p *Consensus) IsMember() bool
- func (p *Consensus) RemovePeer(ctx context.Context, peer *v1.StoragePeer, wait bool) error
- 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) ListenPort() uint16
- func (p *Provider) MeshStorage() storage.MeshStorage
- func (p *Provider) Start(ctx context.Context) error
- func (p *Provider) Status() *v1.StorageStatus
- type Storage
- func (p *Storage) Close() error
- func (p *Storage) Delete(ctx context.Context, key []byte) error
- func (p *Storage) GetValue(ctx context.Context, key []byte) ([]byte, error)
- func (p *Storage) IterPrefix(ctx context.Context, prefix []byte, fn storage.PrefixIterator) error
- func (p *Storage) ListKeys(ctx context.Context, prefix []byte) ([][]byte, error)
- func (p *Storage) PutValue(ctx context.Context, key, value []byte, ttl time.Duration) error
- func (p *Storage) Subscribe(ctx context.Context, prefix []byte, fn storage.SubscribeFunc) (context.CancelFunc, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consensus ¶
type Consensus struct {
*Provider
}
PassthroughConsensus is a consensus provider that returns an error for all write operations.
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. If wait is true, the function will wait for the peer to be removed.
type Options ¶
type Options struct { // NodeID is the ID of the node. NodeID string // Dialer is the dialer to use for connecting to other nodes. Dialer transport.NodeDialer // LogLevel is the log level to use. LogLevel string }
Options are the passthrough options.
type Provider ¶
type Provider struct { Options // contains filtered or unexported fields }
Provider is a storage provider that passes through all storage operations to another node in the cluster.
func NewProvider ¶
NewProvider returns a new passthrough storage provider.
func (*Provider) ListenPort ¶
func (*Provider) MeshStorage ¶
func (p *Provider) MeshStorage() storage.MeshStorage
func (*Provider) Status ¶
func (p *Provider) Status() *v1.StorageStatus
type Storage ¶
type Storage struct {
*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.