## Description Add functions to Collection and Stream interfaces that allow for getting more information about the difference between the previous backup and the currently in-progress one. These will allow delta token-based incremental backups to determine how the state has evolved. Current code does not use these functions and return values for them are "default" values that should result in full backups even if KopiaWrapper is updated to start checking the values and GraphConnector still pulls all items These functions are not used during restore and can return "default" values ## Type of change <!--- Please check the type of change your PR introduces: ---> - [x] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) * #1700 ## Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
67 lines
1.0 KiB
Go
67 lines
1.0 KiB
Go
package kopia
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/alcionai/corso/src/internal/data"
|
|
"github.com/alcionai/corso/src/pkg/path"
|
|
)
|
|
|
|
var (
|
|
_ data.Collection = &kopiaDataCollection{}
|
|
_ data.Stream = &kopiaDataStream{}
|
|
)
|
|
|
|
type kopiaDataCollection struct {
|
|
path path.Path
|
|
streams []data.Stream
|
|
}
|
|
|
|
func (kdc *kopiaDataCollection) Items() <-chan data.Stream {
|
|
res := make(chan data.Stream)
|
|
|
|
go func() {
|
|
defer close(res)
|
|
|
|
for _, s := range kdc.streams {
|
|
res <- s
|
|
}
|
|
}()
|
|
|
|
return res
|
|
}
|
|
|
|
func (kdc kopiaDataCollection) FullPath() path.Path {
|
|
return kdc.path
|
|
}
|
|
|
|
func (kdc kopiaDataCollection) PreviousPath() path.Path {
|
|
return nil
|
|
}
|
|
|
|
func (kdc kopiaDataCollection) State() data.CollectionState {
|
|
return data.NewState
|
|
}
|
|
|
|
type kopiaDataStream struct {
|
|
reader io.ReadCloser
|
|
uuid string
|
|
size int64
|
|
}
|
|
|
|
func (kds kopiaDataStream) ToReader() io.ReadCloser {
|
|
return kds.reader
|
|
}
|
|
|
|
func (kds kopiaDataStream) UUID() string {
|
|
return kds.uuid
|
|
}
|
|
|
|
func (kds kopiaDataStream) Deleted() bool {
|
|
return false
|
|
}
|
|
|
|
func (kds kopiaDataStream) Size() int64 {
|
|
return kds.size
|
|
}
|