41 lines
686 B
Go
41 lines
686 B
Go
package diffsync
|
|
|
|
type Shadow struct {
|
|
localVersion Version
|
|
remoteVersion Version
|
|
content []byte
|
|
backup *Backup
|
|
}
|
|
|
|
func NewShadow(content []byte) *Shadow {
|
|
return &Shadow{
|
|
localVersion: 0,
|
|
remoteVersion: 0,
|
|
content: content,
|
|
backup: NewBackup(Copy(content)),
|
|
}
|
|
}
|
|
|
|
func (s *Shadow) LocalVersion() Version {
|
|
return s.localVersion
|
|
}
|
|
|
|
func (s *Shadow) RemoteVersion() Version {
|
|
return s.remoteVersion
|
|
}
|
|
|
|
func (s *Shadow) Content() []byte {
|
|
return s.content
|
|
}
|
|
|
|
func (s *Shadow) Backup() *Backup {
|
|
return s.backup
|
|
}
|
|
|
|
func Copy(content []byte) []byte {
|
|
contentCopy := make([]byte, len(content))
|
|
copy(contentCopy, content)
|
|
|
|
return contentCopy
|
|
}
|