mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +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 {
|
type State struct {
|
||||||
OldHash string
|
OldHash string
|
||||||
NewHash string
|
NewHash string
|
||||||
LegacyHash string
|
|
||||||
AclId string
|
AclId string
|
||||||
SettingsId string
|
SettingsId string
|
||||||
SpaceId string
|
SpaceId string
|
||||||
|
@ -147,13 +146,21 @@ func (s *stateStorage) SettingsId() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stateStorage) stateFromDoc(doc anystore.Doc) State {
|
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{
|
return State{
|
||||||
SpaceId: doc.Value().GetString(idKey),
|
SpaceId: doc.Value().GetString(idKey),
|
||||||
SettingsId: doc.Value().GetString(settingsIdKey),
|
SettingsId: doc.Value().GetString(settingsIdKey),
|
||||||
AclId: doc.Value().GetString(aclIdKey),
|
AclId: doc.Value().GetString(aclIdKey),
|
||||||
OldHash: doc.Value().GetString(oldHashKey),
|
OldHash: oldHash,
|
||||||
NewHash: doc.Value().GetString(newHashKey),
|
NewHash: newHash,
|
||||||
LegacyHash: doc.Value().GetString(legacyHashKey),
|
|
||||||
SpaceHeader: doc.Value().GetBytes(headerKey),
|
SpaceHeader: doc.Value().GetBytes(headerKey),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue