This commit refactors out the complexity of downloading ordered WAL files in parallel to a type called `WALDownloader`. This makes it easier to test the restore separately from the download.
29 lines
526 B
Go
29 lines
526 B
Go
package mock
|
|
|
|
import (
|
|
"github.com/benbjohnson/litestream"
|
|
)
|
|
|
|
type SnapshotIterator struct {
|
|
CloseFunc func() error
|
|
NextFunc func() bool
|
|
ErrFunc func() error
|
|
SnapshotFunc func() litestream.SnapshotInfo
|
|
}
|
|
|
|
func (itr *SnapshotIterator) Close() error {
|
|
return itr.CloseFunc()
|
|
}
|
|
|
|
func (itr *SnapshotIterator) Next() bool {
|
|
return itr.NextFunc()
|
|
}
|
|
|
|
func (itr *SnapshotIterator) Err() error {
|
|
return itr.ErrFunc()
|
|
}
|
|
|
|
func (itr *SnapshotIterator) Snapshot() litestream.SnapshotInfo {
|
|
return itr.SnapshotFunc()
|
|
}
|