1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-10 18:10:54 +09:00

Add changes with transactions

This commit is contained in:
mcrakhman 2024-09-01 22:44:07 +02:00
parent 3b2acf8021
commit 7ec1e2aa8f
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
9 changed files with 147 additions and 75 deletions

View file

@ -119,15 +119,17 @@ func (s *settingsObject) updateIds(tr objecttree.ObjectTree) {
}
// Update is called as part of UpdateListener interface
func (s *settingsObject) Update(tr objecttree.ObjectTree) {
func (s *settingsObject) Update(tr objecttree.ObjectTree) error {
s.updateIds(tr)
return nil
}
// Rebuild is called as part of UpdateListener interface (including when the object is built for the first time, e.g. on Init call)
func (s *settingsObject) Rebuild(tr objecttree.ObjectTree) {
func (s *settingsObject) Rebuild(tr objecttree.ObjectTree) error {
// at initial build "s" may not contain the object tree, so it is safer to provide it from the function parameter
s.state = nil
s.updateIds(tr)
return nil
}
func (s *settingsObject) Init(ctx context.Context) (err error) {