Documentation
¶
Index ¶
- Constants
- func CheckDataConsistency(ctx context.Context, dir string, keyTo int, username, password string, ...) error
- func ContextWithGracePeriod(parent context.Context, gracePeriod time.Duration) context.Context
- func ContextWithWaitGroup(parent context.Context, wg *sync.WaitGroup) context.Context
- func ContextWithWaitGroupFollwedByGracePeriod(parent context.Context, wg *sync.WaitGroup, gracePeriod time.Duration) context.Context
- func CreateRootUserAndEnableAuth(ctx context.Context, endpoints []string, username, password string) error
- func PopulateEtcd(ctx context.Context, logger *logrus.Entry, endpoints []string, ...)
- func PopulateEtcdWithWaitGroup(ctx context.Context, wg *sync.WaitGroup, logger *logrus.Entry, ...)
- func RunSnapshotter(logger *logrus.Entry, snapstoreConfig brtypes.SnapstoreConfig, ...) error
- func StartEmbeddedEtcd(ctx context.Context, etcdDir string, logger *logrus.Entry, name string, ...) (*embed.Etcd, error)
- type EtcdDataPopulationResponse
Constants ¶
const ( // KeyPrefix is prefix for keys inserted in etcd as a part of etcd-backup-restore tests. KeyPrefix = "/etcdbr/test/key-" // ValuePrefix is prefix for value inserted in etcd as a part of etcd-backup-restore tests. ValuePrefix = "val-" // EmbeddedEtcdPortNo defines PortNo which can be used to start EmbeddedEtcd. EmbeddedEtcdPortNo = "12379" // DefaultEtcdName defines the default etcd name used to start EmbeddedEtcd. DefaultEtcdName = "default" )
Variables ¶
This section is empty.
Functions ¶
func CheckDataConsistency ¶
func CheckDataConsistency(ctx context.Context, dir string, keyTo int, username, password string, logger *logrus.Entry) error
CheckDataConsistency starts an embedded etcd and checks for correctness of the values stored in etcd against the keys 'keyFrom' through 'keyTo' A valid username and password must be provided if etcd auth is enabled.
func ContextWithGracePeriod ¶
ContextWithGracePeriod returns a new context, whose Done channel is closed when parent context is closed with additional <gracePeriod>.
func ContextWithWaitGroup ¶
ContextWithWaitGroup returns a copy of parent with a new Done channel. The returned context's Done channel is closed when the the passed waitGroup's Wait function is called or when the parent context's Done channel is closed, whichever happens first.
func ContextWithWaitGroupFollwedByGracePeriod ¶
func ContextWithWaitGroupFollwedByGracePeriod(parent context.Context, wg *sync.WaitGroup, gracePeriod time.Duration) context.Context
ContextWithWaitGroupFollwedByGracePeriod returns a new context, whose Done channel is closed when parent context is closed or wait of waitGroup is over, with additional <gracePeriod>.
func CreateRootUserAndEnableAuth ¶ added in v0.41.0
func CreateRootUserAndEnableAuth(ctx context.Context, endpoints []string, username, password string) error
CreateRootUserAndEnableAuth does the following on an existing etcd cluster that has auth disabled:
- Create a new user using the provided name and password.
- Grant "root" role to the created user.
- Enable auth in etcd.
func PopulateEtcd ¶
func PopulateEtcd(ctx context.Context, logger *logrus.Entry, endpoints []string, username, password string, keyFrom, keyTo int, response *EtcdDataPopulationResponse)
PopulateEtcd sequentially puts key-value pairs into the embedded etcd, from key <keyFrom> (including) to <keyTo> (excluding). Every key divisible by 10 will be be added and deleted immediately. So, for such key you will observer two events on etcd PUT and DELETE and key not being present in etcd at end. A valid username and password must be provided if etcd auth is enabled.
func PopulateEtcdWithWaitGroup ¶
func PopulateEtcdWithWaitGroup(ctx context.Context, wg *sync.WaitGroup, logger *logrus.Entry, endpoints []string, username, password string, resp *EtcdDataPopulationResponse)
PopulateEtcdWithWaitGroup sequentially puts key-value pairs into the embedded etcd, until stopped via context. Use `wg.Wait()` to make sure that etcd population has stopped completely. A valid username and password must be provided if etcd auth is enabled.
func RunSnapshotter ¶
func RunSnapshotter(logger *logrus.Entry, snapstoreConfig brtypes.SnapstoreConfig, deltaSnapshotPeriod time.Duration, endpoints []string, username, password string, stopCh <-chan struct{}, startWithFullSnapshot bool, compressionConfig *compressor.CompressionConfig) error
RunSnapshotter creates a snapshotter object and runs it for a duration specified by 'snapshotterDurationSeconds' A valid username and password must be provided if etcd auth is enabled.
func StartEmbeddedEtcd ¶
func StartEmbeddedEtcd(ctx context.Context, etcdDir string, logger *logrus.Entry, name string, port string) (*embed.Etcd, error)
StartEmbeddedEtcd starts the embedded etcd for test purpose with minimal configuration at a given port. To get the exact client endpoints it is listening on, use returns etcd.Clients[0].Addr().String()
Types ¶
type EtcdDataPopulationResponse ¶
EtcdDataPopulationResponse is response about etcd data population