Files
litestream/mock/wal_segment_iterator.go
Ben Johnson 3f0ec9fa9f Refactor Restore()
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.
2022-01-04 15:03:59 -07:00

29 lines
552 B
Go

package mock
import (
"github.com/benbjohnson/litestream"
)
type WALSegmentIterator struct {
CloseFunc func() error
NextFunc func() bool
ErrFunc func() error
WALSegmentFunc func() litestream.WALSegmentInfo
}
func (itr *WALSegmentIterator) Close() error {
return itr.CloseFunc()
}
func (itr *WALSegmentIterator) Next() bool {
return itr.NextFunc()
}
func (itr *WALSegmentIterator) Err() error {
return itr.ErrFunc()
}
func (itr *WALSegmentIterator) WALSegment() litestream.WALSegmentInfo {
return itr.WALSegmentFunc()
}