mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
taildrop: add logic for resuming partial files (#9785)
We add the following API: * type FileChecksums * type Checksum * func Manager.PartialFiles * func Manager.HashPartialFile * func ResumeReader The Manager methods provide the ability to query for partial files and retrieve a list of checksums for a given partial file. The ResumeReader function is a helper that wraps an io.Reader to discard content that is identical locally and remotely. The FileChecksums type represents the checksums of a file and is safe to JSON marshal and send over the wire. Updates tailscale/corp#14772 Signed-off-by: Joe Tsai <joetsai@digital-static.net> Co-authored-by: Rhea Ghosh <rhea@tailscale.com>
This commit is contained in:
@@ -3552,7 +3552,7 @@ func (b *LocalBackend) initPeerAPIListener() {
|
||||
b: b,
|
||||
taildrop: &taildrop.Manager{
|
||||
Logf: b.logf,
|
||||
Clock: b.clock,
|
||||
Clock: tstime.DefaultClock{b.clock},
|
||||
Dir: fileRoot,
|
||||
DirectFileMode: b.directFileRoot != "",
|
||||
AvoidFinalRename: !b.directFileDoFinalRename,
|
||||
|
@@ -541,8 +541,7 @@ func TestHandlePeerAPI(t *testing.T) {
|
||||
rootDir = t.TempDir()
|
||||
if e.ph.ps.taildrop == nil {
|
||||
e.ph.ps.taildrop = &taildrop.Manager{
|
||||
Logf: e.logBuf.Logf,
|
||||
Clock: &tstest.Clock{},
|
||||
Logf: e.logBuf.Logf,
|
||||
}
|
||||
}
|
||||
e.ph.ps.taildrop.Dir = rootDir
|
||||
@@ -585,9 +584,8 @@ func TestFileDeleteRace(t *testing.T) {
|
||||
clock: &tstest.Clock{},
|
||||
},
|
||||
taildrop: &taildrop.Manager{
|
||||
Logf: t.Logf,
|
||||
Clock: &tstest.Clock{},
|
||||
Dir: dir,
|
||||
Logf: t.Logf,
|
||||
Dir: dir,
|
||||
},
|
||||
}
|
||||
ph := &peerAPIHandler{
|
||||
|
Reference in New Issue
Block a user