mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-31 22:11:51 +00:00
This records the time a file was marked as deleted. It will, in the future, aid in garbage collecting old files.
This commit is contained in:
parent
b4064e07dc
commit
b61da487e4
@ -127,6 +127,7 @@ func (f FileInfoTruncated) FilePermissions() uint32 {
|
|||||||
func (f FileInfoTruncated) FileModifiedBy() protocol.ShortID {
|
func (f FileInfoTruncated) FileModifiedBy() protocol.ShortID {
|
||||||
return f.ModifiedBy
|
return f.ModifiedBy
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f FileInfoTruncated) ConvertToIgnoredFileInfo(by protocol.ShortID) protocol.FileInfo {
|
func (f FileInfoTruncated) ConvertToIgnoredFileInfo(by protocol.ShortID) protocol.FileInfo {
|
||||||
return protocol.FileInfo{
|
return protocol.FileInfo{
|
||||||
Name: f.Name,
|
Name: f.Name,
|
||||||
@ -140,6 +141,18 @@ func (f FileInfoTruncated) ConvertToIgnoredFileInfo(by protocol.ShortID) protoco
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f FileInfoTruncated) ConvertToDeletedFileInfo(by protocol.ShortID, localFlags uint32) protocol.FileInfo {
|
||||||
|
return protocol.FileInfo{
|
||||||
|
Name: f.Name,
|
||||||
|
Type: f.Type,
|
||||||
|
ModifiedS: time.Now().Unix(),
|
||||||
|
ModifiedBy: by,
|
||||||
|
Deleted: true,
|
||||||
|
Version: f.Version.Update(by),
|
||||||
|
LocalFlags: localFlags,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c Counts) Add(other Counts) Counts {
|
func (c Counts) Add(other Counts) Counts {
|
||||||
return Counts{
|
return Counts{
|
||||||
Files: c.Files + other.Files,
|
Files: c.Files + other.Files,
|
||||||
|
@ -532,22 +532,11 @@ func (f *folder) scanSubdirs(subDirs []string) error {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
nf := protocol.FileInfo{
|
nf := file.ConvertToDeletedFileInfo(f.shortID, f.localFlags)
|
||||||
Name: file.Name,
|
|
||||||
Type: file.Type,
|
|
||||||
Size: 0,
|
|
||||||
ModifiedS: file.ModifiedS,
|
|
||||||
ModifiedNs: file.ModifiedNs,
|
|
||||||
ModifiedBy: f.shortID,
|
|
||||||
Deleted: true,
|
|
||||||
Version: file.Version.Update(f.shortID),
|
|
||||||
LocalFlags: f.localFlags,
|
|
||||||
}
|
|
||||||
// We do not want to override the global version
|
|
||||||
// with the deleted file. Setting to an empty
|
|
||||||
// version makes sure the file gets in sync on
|
|
||||||
// the following pull.
|
|
||||||
if file.ShouldConflict() {
|
if file.ShouldConflict() {
|
||||||
|
// We do not want to override the global version with
|
||||||
|
// the deleted file. Setting to an empty version makes
|
||||||
|
// sure the file gets in sync on the following pull.
|
||||||
nf.Version = protocol.Vector{}
|
nf.Version = protocol.Vector{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +107,7 @@ func (f *receiveOnlyFolder) Revert() {
|
|||||||
fi = protocol.FileInfo{
|
fi = protocol.FileInfo{
|
||||||
Name: fi.Name,
|
Name: fi.Name,
|
||||||
Type: fi.Type,
|
Type: fi.Type,
|
||||||
ModifiedS: fi.ModifiedS,
|
ModifiedS: time.Now().Unix(),
|
||||||
ModifiedNs: fi.ModifiedNs,
|
|
||||||
ModifiedBy: f.shortID,
|
ModifiedBy: f.shortID,
|
||||||
Deleted: true,
|
Deleted: true,
|
||||||
Version: protocol.Vector{}, // if this file ever resurfaces anywhere we want our delete to be strictly older
|
Version: protocol.Vector{}, // if this file ever resurfaces anywhere we want our delete to be strictly older
|
||||||
|
Loading…
Reference in New Issue
Block a user