feat: Add io.Writer-based API to restore and fetch cmds
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"archive/tar"
|
||||
"context"
|
||||
"database/sql"
|
||||
"io"
|
||||
"io/fs"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -13,7 +15,14 @@ import (
|
||||
"github.com/pojntfx/stfs/pkg/recovery"
|
||||
)
|
||||
|
||||
func (o *Operations) Restore(from string, to string, flatten bool) error {
|
||||
func (o *Operations) Restore(
|
||||
getDst func(path string, mode fs.FileMode) (io.WriteCloser, error),
|
||||
mkdirAll func(path string, mode fs.FileMode) error,
|
||||
|
||||
from string,
|
||||
to string,
|
||||
flatten bool,
|
||||
) error {
|
||||
o.diskOperationLock.Lock()
|
||||
defer o.diskOperationLock.Unlock()
|
||||
|
||||
@@ -84,6 +93,9 @@ func (o *Operations) Restore(from string, to string, flatten bool) error {
|
||||
o.pipes,
|
||||
o.crypto,
|
||||
|
||||
getDst,
|
||||
mkdirAll,
|
||||
|
||||
o.pipes.RecordSize,
|
||||
int(dbhdr.Record),
|
||||
int(dbhdr.Block),
|
||||
|
||||
Reference in New Issue
Block a user