mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-07 21:47:02 +09:00
Remove legacy hash
This commit is contained in:
parent
25bd9ca4a4
commit
4a98522b4f
1 changed files with 11 additions and 4 deletions
|
@ -11,7 +11,6 @@ import (
|
|||
type State struct {
|
||||
OldHash string
|
||||
NewHash string
|
||||
LegacyHash string
|
||||
AclId string
|
||||
SettingsId string
|
||||
SpaceId string
|
||||
|
@ -147,13 +146,21 @@ func (s *stateStorage) SettingsId() string {
|
|||
}
|
||||
|
||||
func (s *stateStorage) stateFromDoc(doc anystore.Doc) State {
|
||||
var (
|
||||
oldHash = doc.Value().GetString(oldHashKey)
|
||||
newHash = doc.Value().GetString(newHashKey)
|
||||
)
|
||||
// legacy hash is used for backward compatibility, which was due to a mistake in key names
|
||||
if oldHash == "" || newHash == "" {
|
||||
oldHash = doc.Value().GetString(legacyHashKey)
|
||||
newHash = oldHash
|
||||
}
|
||||
return State{
|
||||
SpaceId: doc.Value().GetString(idKey),
|
||||
SettingsId: doc.Value().GetString(settingsIdKey),
|
||||
AclId: doc.Value().GetString(aclIdKey),
|
||||
OldHash: doc.Value().GetString(oldHashKey),
|
||||
NewHash: doc.Value().GetString(newHashKey),
|
||||
LegacyHash: doc.Value().GetString(legacyHashKey),
|
||||
OldHash: oldHash,
|
||||
NewHash: newHash,
|
||||
SpaceHeader: doc.Value().GetBytes(headerKey),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue