mirror of
https://github.com/kopia/kopia.git
synced 2026-09-08 11:26:03 -04:00
feat(snapshots): Callback for when uploader finishes processing a file (#2331)
* Make callback for upload file completion Callback does not indicate that a file will be reachable immediately in the resulting snapshot, but does indicate that the uploader is done processing the file in some way (either via uploading data or finding a previous version in the repo) and whether there was an error processing the file. * Tests for new FinishedFile callback Ensure hadErr is properly populated and FinishedFile is called even if the file was considered cached. * Refine comment on interface function slightly * Give callback error instead of bool about error * Add locks around concurrent accesses in test
This commit is contained in:
1 parent
b97e567d06
commit
5c88bcf1a6
5 files changed
+137
-3
No files matched your search
@@ -115,6 +115,25 @@ func (imd *Directory) AddFile(name string, content []byte, permissions os.FileMo
|
||||
return file
|
||||
}
|
||||
|
||||
// AddFileWithSource adds a mock file with the specified name, permissions, and
|
||||
// given source function for getting a Reader instance.
|
||||
func (imd *Directory) AddFileWithSource(name string, permissions os.FileMode, source func() (ReaderSeekerCloser, error)) *File {
|
||||
imd, name = imd.resolveSubdir(name)
|
||||
file := &File{
|
||||
entry: entry{
|
||||
name: name,
|
||||
mode: permissions,
|
||||
size: 0,
|
||||
modTime: DefaultModTime,
|
||||
},
|
||||
source: source,
|
||||
}
|
||||
|
||||
imd.addChild(file)
|
||||
|
||||
return file
|
||||
}
|
||||
|
||||
// AddSymlink adds a mock symlink with the specified name, target and permissions.
|
||||
func (imd *Directory) AddSymlink(name, target string, permissions os.FileMode) *Symlink {
|
||||
imd, name = imd.resolveSubdir(name)
|
||||
|
||||
Reference in new issue
Block a user