Documentation
¶
Index ¶
- type Downloader
- type Receiver
- func (r *Receiver) HasSnapshots() bool
- func (r *Receiver) MarkCorrupt(filename string, err error)
- func (r *Receiver) Next() (instance string, update snapshot.Update)
- func (r *Receiver) Run(ctx context.Context) error
- func (r *Receiver) RunOnce(ctx context.Context, includingOwn bool) error
- func (r *Receiver) SeenInstances() (names []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
func (*Downloader) NotifyNewSnapshot ¶
func (d *Downloader) NotifyNewSnapshot()
NotifyNewSnapshot notifies the downloader that a new snapshot is available. This never blocks. The chan has capacity 1. If a signal is already in there, we do not need to add another one.
func (*Downloader) Run ¶
func (d *Downloader) Run(ctx context.Context) error
Run keeps downloading and unpacking new snapshots, and offering them to the update loop. It checks the Receiver for the latest version that it has seen, and downloads that snapshot if it has not been loaded yet. When a download or load fails, it keeps retrying the latest snapshots with a delay in between. Eventually either the load succeeds, or a new snapshot becomes available that can be loaded.
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver monitors a storage backend, downloads updates and notifies the syncer.Syncer of new snapshots. When the Syncer gets around to handle a snapshot, it will offer the latest version available instead of the version that was available at the time of notification. It spawns per-instance Downloader goroutines to take care of the actual downloading.
func (*Receiver) HasSnapshots ¶
HasSnapshots indicates if there are any snapshots in the storage backend for our prefix.
func (*Receiver) MarkCorrupt ¶
MarkCorrupt marks a snapshot as corrupt. We will ignore the filename in the future. This can cause a previous snapshot to be promoted to the latest for an instance, or for the instance to disappear from the SeenInstances() if this was the only remaining snapshot.
func (*Receiver) Next ¶
Next returns the next remote snapshot.Update to process if there is one It is to be called by the Syncer.
func (*Receiver) SeenInstances ¶
SeenInstances returns all seen instance names. This includes our own instance, even if RunOnce was called with includingOwn set to false.