Documentation ¶
Index ¶
- Constants
- type Config
- type Snapshotter
- func (ssr *Snapshotter) CollectEventsSincePrevSnapshot(stopCh <-chan struct{}) (bool, error)
- func (ssr *Snapshotter) Run(stopCh <-chan struct{}, startWithFullSnapshot bool) error
- func (ssr *Snapshotter) RunGarbageCollector(stopCh <-chan struct{})
- func (ssr *Snapshotter) TakeDeltaSnapshot() error
- func (ssr *Snapshotter) TakeFullSnapshotAndResetTimer() error
- func (ssr *Snapshotter) TriggerFullSnapshot() error
- type State
Constants ¶
const ( // GarbageCollectionPolicyExponential defines the exponential policy for garbage collecting old backups GarbageCollectionPolicyExponential = "Exponential" // GarbageCollectionPolicyLimitBased defines the limit based policy for garbage collecting old backups GarbageCollectionPolicyLimitBased = "LimitBased" // DefaultMaxBackups is default number of maximum backups for limit based garbage collection policy. DefaultMaxBackups = 7 // SnapshotterInactive is set when the snapshotter has not started taking snapshots. SnapshotterInactive State = 0 // SnapshotterActive is set when the snapshotter has started taking snapshots. SnapshotterActive State = 1 // DefaultDeltaSnapMemoryLimit is default memory limit for delta snapshots. DefaultDeltaSnapMemoryLimit = 10 * 1024 * 1024 //10Mib // DefaultDeltaSnapshotIntervalSeconds is the default interval for delta snapshots in seconds. DefaultDeltaSnapshotIntervalSeconds = 20 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config stores the configuration parameters for the snapshotter.
func NewSnapshotterConfig ¶
func NewSnapshotterConfig(schedule string, store snapstore.SnapStore, maxBackups, deltaSnapshotIntervalSeconds, deltaSnapshotMemoryLimit int, etcdConnectionTimeout, garbageCollectionPeriodSeconds time.Duration, garbageCollectionPolicy string, tlsConfig *etcdutil.TLSConfig) (*Config, error)
NewSnapshotterConfig returns a config for the snapshotter.
type Snapshotter ¶
type Snapshotter struct { PrevFullSnapshot *snapstore.Snapshot SsrStateMutex *sync.Mutex SsrState State // contains filtered or unexported fields }
Snapshotter is a struct for etcd snapshot taker
func NewSnapshotter ¶
func NewSnapshotter(logger *logrus.Logger, config *Config) *Snapshotter
NewSnapshotter returns the snapshotter object.
func (*Snapshotter) CollectEventsSincePrevSnapshot ¶
func (ssr *Snapshotter) CollectEventsSincePrevSnapshot(stopCh <-chan struct{}) (bool, error)
CollectEventsSincePrevSnapshot takes the first delta snapshot on etcd startup.
func (*Snapshotter) Run ¶
func (ssr *Snapshotter) Run(stopCh <-chan struct{}, startWithFullSnapshot bool) error
Run process loop for scheduled backup Setting startWithFullSnapshot to false will start the snapshotter without taking the first full snapshot.
func (*Snapshotter) RunGarbageCollector ¶
func (ssr *Snapshotter) RunGarbageCollector(stopCh <-chan struct{})
RunGarbageCollector basically consider the older backups as garbage and deletes it
func (*Snapshotter) TakeDeltaSnapshot ¶
func (ssr *Snapshotter) TakeDeltaSnapshot() error
TakeDeltaSnapshot takes a delta snapshot that contains the etcd events collected up till now
func (*Snapshotter) TakeFullSnapshotAndResetTimer ¶
func (ssr *Snapshotter) TakeFullSnapshotAndResetTimer() error
TakeFullSnapshotAndResetTimer takes a full snapshot and resets the full snapshot timer as per the schedule.
func (*Snapshotter) TriggerFullSnapshot ¶
func (ssr *Snapshotter) TriggerFullSnapshot() error
TriggerFullSnapshot sends the events to take full snapshot. This is to trigger full snapshot externally out of regular schedule.