Add interface to get version of item

Pass version as UID in OwnerInfo to kopia to allow more control of what
kopia thinks is a cached file.
This commit is contained in:
Ashlie Martinez 2023-02-01 16:29:32 -08:00
parent 41d5550b4b
commit 0928e53a8b
2 changed files with 10 additions and 0 deletions

View File

@ -87,6 +87,10 @@ type StreamModTime interface {
ModTime() time.Time
}
type Versioner interface {
Version() uint32
}
// ------------------------------------------------------------------------------------------------
// functionality
// ------------------------------------------------------------------------------------------------

View File

@ -339,9 +339,15 @@ func collectionEntries(
modTime = smt.ModTime()
}
o := fs.OwnerInfo{}
if sv, ok := e.(data.Versioner); ok {
o.UserID = sv.Version()
}
entry := virtualfs.StreamingFileWithModTimeFromReader(
encodedName,
modTime,
o,
newBackupStreamReader(serializationVersion, e.ToReader()),
)
if err := cb(ctx, entry); err != nil {