Documentation ¶
Index ¶
- Constants
- func CheckDataConsistency(ctx context.Context, dir string, keyTo int, logger *logrus.Entry) 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 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 ¶
CheckDataConsistency starts an embedded etcd and checks for correctness of the values stored in etcd against the keys 'keyFrom' through 'keyTo'
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 PopulateEtcd ¶
func PopulateEtcd(ctx context.Context, logger *logrus.Entry, endpoints []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.
func PopulateEtcdWithWaitGroup ¶
func PopulateEtcdWithWaitGroup(ctx context.Context, wg *sync.WaitGroup, logger *logrus.Entry, endpoints []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.
func RunSnapshotter ¶
func RunSnapshotter(logger *logrus.Entry, snapstoreConfig brtypes.SnapstoreConfig, deltaSnapshotPeriod time.Duration, endpoints []string, stopCh <-chan struct{}, startWithFullSnapshot bool, compressionConfig *compressor.CompressionConfig) error
RunSnapshotter creates a snapshotter object and runs it for a duration specified by 'snapshotterDurationSeconds'
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