From 6f86c196b1a2cb36405eaeddb14ba4891e722675 Mon Sep 17 00:00:00 2001 From: Sergey Date: Tue, 25 Apr 2023 18:17:59 +0200 Subject: [PATCH] Atomic changes for storing slices in a state --- core/block/collection/service.go | 7 +- core/block/editor/smartblock/smartblock.go | 4 +- core/block/editor/state/change.go | 22 + core/block/editor/state/change_test.go | 8 +- core/block/editor/state/state.go | 42 + core/block/simple/dataview/view_changes.go | 31 +- pb/changes.pb.go | 1372 ++++++++++++++++++-- pb/protos/changes.proto | 24 + util/slice/diff.go | 25 + 9 files changed, 1369 insertions(+), 166 deletions(-) diff --git a/core/block/collection/service.go b/core/block/collection/service.go index e67bf89a1..1adacd18c 100644 --- a/core/block/collection/service.go +++ b/core/block/collection/service.go @@ -32,11 +32,12 @@ const storeKey = "objects" func (s *Service) Add(ctx *session.Context, req *pb.RpcObjectCollectionAddRequest) error { return s.updateCollection(ctx, req.ContextId, func(col []string) []string { + toAdd := slice.Difference(req.ObjectIds, col) pos := slice.FindPos(col, req.AfterId) if pos >= 0 { - col = slice.Insert(col, pos+1, req.ObjectIds...) + col = slice.Insert(col, pos+1, toAdd...) } else { - col = append(col, req.ObjectIds...) + col = append(col, toAdd...) } return col }) @@ -73,7 +74,7 @@ func (s *Service) updateCollection(ctx *session.Context, contextID string, modif store := s.Store() lst := pbtypes.GetStringList(store, storeKey) lst = modifier(lst) - s.SetInStore([]string{storeKey}, pbtypes.StringList(lst)) + s.StoreSlice(storeKey, lst) return nil }) } diff --git a/core/block/editor/smartblock/smartblock.go b/core/block/editor/smartblock/smartblock.go index 376a959f7..a3833f553 100644 --- a/core/block/editor/smartblock/smartblock.go +++ b/core/block/editor/smartblock/smartblock.go @@ -1407,7 +1407,9 @@ func ObjectApplyTemplate(sb SmartBlock, s *state.State, templates ...template.St func hasStoreChanges(changes []*pb.ChangeContent) bool { for _, ch := range changes { - if ch.GetStoreKeySet() != nil || ch.GetStoreKeyUnset() != nil { + if ch.GetStoreKeySet() != nil || + ch.GetStoreKeyUnset() != nil || + ch.GetStoreSliceUpdate() != nil { return true } } diff --git a/core/block/editor/state/change.go b/core/block/editor/state/change.go index 12ac608a2..5e24286f0 100644 --- a/core/block/editor/state/change.go +++ b/core/block/editor/state/change.go @@ -214,6 +214,11 @@ func (s *State) applyChange(ch *pb.ChangeContent) (err error) { return } s.changes = append(s.changes, ch) + case ch.GetStoreSliceUpdate() != nil: + // TODO optimize: collect changes then apply them on one shot + if err = s.changeStoreSliceUpdate(ch.GetStoreSliceUpdate()); err != nil { + return + } default: return fmt.Errorf("unexpected changes content type: %v", ch) } @@ -449,6 +454,23 @@ func (s *State) changeStoreKeyUnset(unset *pb.ChangeStoreKeyUnset) error { return nil } +func (s *State) changeStoreSliceUpdate(upd *pb.ChangeStoreSliceUpdate) error { + var changes []slice.Change[string] + if v := upd.GetAdd(); v != nil { + changes = append(changes, slice.MakeChangeAdd(v.Ids, v.AfterId)) + } else if v := upd.GetRemove(); v != nil { + changes = append(changes, slice.MakeChangeRemove[string](v.Ids)) + } else if v := upd.GetMove(); v != nil { + changes = append(changes, slice.MakeChangeMove[string](v.Ids, v.AfterId)) + } + + store := s.Store() + old := pbtypes.GetStringList(store, upd.Key) + cur := slice.ApplyChanges(old, changes, slice.StringIdentity[string]) + s.setInStore([]string{upd.Key}, pbtypes.StringList(cur)) + return nil +} + func (s *State) GetChanges() []*pb.ChangeContent { return s.changes } diff --git a/core/block/editor/state/change_test.go b/core/block/editor/state/change_test.go index c8615508d..7fc941615 100644 --- a/core/block/editor/state/change_test.go +++ b/core/block/editor/state/change_test.go @@ -90,6 +90,8 @@ func TestState_ChangesCreate_Collection_Unset(t *testing.T) { }).String(), changes[0].String()) } +// TODO tests for atomic changes + func TestState_ChangesCreate_MoveAdd_Wrap(t *testing.T) { d := NewDoc("root", map[string]simple.Block{ "root": simple.New(&model.Block{Id: "root", ChildrenIds: []string{"a", "b"}}), @@ -208,7 +210,7 @@ func TestStateNormalizeMerge(t *testing.T) { stateA.InsertTo("common39", model.Block_Bottom, "a1", "a2") _, _, err = ApplyState(stateA, true) require.NoError(t, err) - //t.Log(docA.String()) + // t.Log(docA.String()) changesA := stateA.GetChanges() docB := d.Copy() @@ -217,7 +219,7 @@ func TestStateNormalizeMerge(t *testing.T) { stateB.InsertTo("common39", model.Block_Bottom, "b1") _, _, err = ApplyState(stateB, true) require.NoError(t, err) - //t.Log(docB.String()) + // t.Log(docB.String()) changesB := stateB.GetChanges() s = d.NewState() @@ -233,7 +235,7 @@ func TestStateNormalizeMerge(t *testing.T) { assert.True(t, CleanupLayouts(s) > 0) ids = append(ids, "a1", "a2", "b1") assert.Equal(t, ids, s.Pick("parent").Model().ChildrenIds) - //t.Log(s.String()) + // t.Log(s.String()) }) t.Run("rebalance", func(t *testing.T) { d := d.Copy() diff --git a/core/block/editor/state/state.go b/core/block/editor/state/state.go index 8196bb0f1..33ea0f329 100644 --- a/core/block/editor/state/state.go +++ b/core/block/editor/state/state.go @@ -1439,6 +1439,48 @@ func (s *State) SetInStore(path []string, value *types.Value) (changed bool) { return } +func (s *State) StoreSlice(key string, val []string) { + old := pbtypes.GetStringList(s.Store(), key) + s.setInStore([]string{key}, pbtypes.StringList(val)) + + diff := slice.Diff(old, val, slice.StringIdentity[string], slice.Equal[string]) + changes := slice.UnwrapChanges(diff, + func(afterID string, items []string) *pb.ChangeStoreSliceUpdate { + return &pb.ChangeStoreSliceUpdate{ + Operation: &pb.ChangeStoreSliceUpdateOperationOfAdd{ + Add: &pb.ChangeStoreSliceUpdateAdd{ + AfterId: afterID, + Ids: items, + }, + }, + } + }, func(items []string) *pb.ChangeStoreSliceUpdate { + return &pb.ChangeStoreSliceUpdate{ + Operation: &pb.ChangeStoreSliceUpdateOperationOfRemove{ + Remove: &pb.ChangeStoreSliceUpdateRemove{ + Ids: items, + }, + }, + } + }, func(afterID string, items []string) *pb.ChangeStoreSliceUpdate { + return &pb.ChangeStoreSliceUpdate{ + Operation: &pb.ChangeStoreSliceUpdateOperationOfMove{ + Move: &pb.ChangeStoreSliceUpdateMove{ + AfterId: afterID, + Ids: items, + }, + }, + } + }, nil) + + for _, ch := range changes { + ch.Key = key + s.changes = append(s.changes, &pb.ChangeContent{ + Value: &pb.ChangeContentValueOfStoreSliceUpdate{StoreSliceUpdate: ch}, + }) + } +} + func (s *State) HasInStore(path []string) bool { store := s.Store() if store.GetFields() == nil { diff --git a/core/block/simple/dataview/view_changes.go b/core/block/simple/dataview/view_changes.go index b7d194e00..7bfd98a72 100644 --- a/core/block/simple/dataview/view_changes.go +++ b/core/block/simple/dataview/view_changes.go @@ -50,7 +50,7 @@ func diffViewFilters(a, b *model.BlockContentDataviewView) []*pb.EventBlockDatav return nil } - return unwrapChanges( + return slice.UnwrapChanges( diff, func(afterID string, items []*model.BlockContentDataviewFilter) *pb.EventBlockDataviewViewUpdateFilter { return &pb.EventBlockDataviewViewUpdateFilter{ @@ -108,7 +108,7 @@ func diffViewRelations(a, b *model.BlockContentDataviewView) []*pb.EventBlockDat return nil } - return unwrapChanges( + return slice.UnwrapChanges( diff, func(afterID string, items []*model.BlockContentDataviewRelation) *pb.EventBlockDataviewViewUpdateRelation { return &pb.EventBlockDataviewViewUpdateRelation{ @@ -166,7 +166,7 @@ func diffViewSorts(a, b *model.BlockContentDataviewView) []*pb.EventBlockDatavie return nil } - return unwrapChanges( + return slice.UnwrapChanges( diff, func(afterID string, items []*model.BlockContentDataviewSort) *pb.EventBlockDataviewViewUpdateSort { return &pb.EventBlockDataviewViewUpdateSort{ @@ -280,31 +280,6 @@ func (l *Dataview) ApplyViewUpdate(upd *pb.EventBlockDataviewViewUpdate) { } } -func unwrapChanges[T, R any]( - changes []slice.Change[T], - add func(afterID string, items []T) R, - remove func(ids []string) R, - move func(afterID string, ids []string) R, - update func(id string, item T) R, -) []R { - res := make([]R, 0, len(changes)) - for _, c := range changes { - if v := c.Add(); v != nil { - res = append(res, add(v.AfterID, v.Items)) - } - if v := c.Remove(); v != nil { - res = append(res, remove(v.IDs)) - } - if v := c.Move(); v != nil { - res = append(res, move(v.AfterID, v.IDs)) - } - if v := c.Replace(); v != nil { - res = append(res, update(v.ID, v.Item)) - } - } - return res -} - func diffViewObjectOrder(a, b *model.BlockContentDataviewObjectOrder) []*pb.EventBlockDataviewSliceChange { diff := slice.Diff(a.ObjectIds, b.ObjectIds, slice.StringIdentity[string], slice.Equal[string]) if len(diff) == 0 { diff --git a/pb/changes.pb.go b/pb/changes.pb.go index 61d8df1cd..d7bf1ed33 100644 --- a/pb/changes.pb.go +++ b/pb/changes.pb.go @@ -39,8 +39,7 @@ type Change struct { // file keys related to changes content FileKeys []*ChangeFileKeys `protobuf:"bytes,6,rep,name=fileKeys,proto3" json:"fileKeys,omitempty"` // creation timestamp - Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Version string `protobuf:"bytes,8,opt,name=version,proto3" json:"version,omitempty"` + Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } func (m *Change) Reset() { *m = Change{} } @@ -125,13 +124,6 @@ func (m *Change) GetTimestamp() int64 { return 0 } -func (m *Change) GetVersion() string { - if m != nil { - return m.Version - } - return "" -} - type ChangeSnapshot struct { // logId -> lastChangeId LogHeads map[string]string `protobuf:"bytes,1,rep,name=logHeads,proto3" json:"logHeads,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` @@ -265,6 +257,7 @@ type ChangeContent struct { // *ChangeContentValueOfObjectTypeRemove // *ChangeContentValueOfStoreKeySet // *ChangeContentValueOfStoreKeyUnset + // *ChangeContentValueOfStoreSliceUpdate Value IsChangeContentValue `protobuf_oneof:"value"` } @@ -355,6 +348,9 @@ type ChangeContentValueOfStoreKeySet struct { type ChangeContentValueOfStoreKeyUnset struct { StoreKeyUnset *ChangeStoreKeyUnset `protobuf:"bytes,108,opt,name=storeKeyUnset,proto3,oneof" json:"storeKeyUnset,omitempty"` } +type ChangeContentValueOfStoreSliceUpdate struct { + StoreSliceUpdate *ChangeStoreSliceUpdate `protobuf:"bytes,109,opt,name=storeSliceUpdate,proto3,oneof" json:"storeSliceUpdate,omitempty"` +} func (*ChangeContentValueOfBlockCreate) IsChangeContentValue() {} func (*ChangeContentValueOfBlockUpdate) IsChangeContentValue() {} @@ -372,6 +368,7 @@ func (*ChangeContentValueOfObjectTypeAdd) IsChangeContentValue() {} func (*ChangeContentValueOfObjectTypeRemove) IsChangeContentValue() {} func (*ChangeContentValueOfStoreKeySet) IsChangeContentValue() {} func (*ChangeContentValueOfStoreKeyUnset) IsChangeContentValue() {} +func (*ChangeContentValueOfStoreSliceUpdate) IsChangeContentValue() {} func (m *ChangeContent) GetValue() IsChangeContentValue { if m != nil { @@ -492,6 +489,13 @@ func (m *ChangeContent) GetStoreKeyUnset() *ChangeStoreKeyUnset { return nil } +func (m *ChangeContent) GetStoreSliceUpdate() *ChangeStoreSliceUpdate { + if x, ok := m.GetValue().(*ChangeContentValueOfStoreSliceUpdate); ok { + return x.StoreSliceUpdate + } + return nil +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*ChangeContent) XXX_OneofWrappers() []interface{} { return []interface{}{ @@ -511,6 +515,7 @@ func (*ChangeContent) XXX_OneofWrappers() []interface{} { (*ChangeContentValueOfObjectTypeRemove)(nil), (*ChangeContentValueOfStoreKeySet)(nil), (*ChangeContentValueOfStoreKeyUnset)(nil), + (*ChangeContentValueOfStoreSliceUpdate)(nil), } } @@ -1471,6 +1476,260 @@ func (m *ChangeStoreKeyUnset) GetPath() []string { return nil } +type ChangeStoreSliceUpdate struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Types that are valid to be assigned to Operation: + // *ChangeStoreSliceUpdateOperationOfAdd + // *ChangeStoreSliceUpdateOperationOfRemove + // *ChangeStoreSliceUpdateOperationOfMove + Operation IsChangeStoreSliceUpdateOperation `protobuf_oneof:"operation"` +} + +func (m *ChangeStoreSliceUpdate) Reset() { *m = ChangeStoreSliceUpdate{} } +func (m *ChangeStoreSliceUpdate) String() string { return proto.CompactTextString(m) } +func (*ChangeStoreSliceUpdate) ProtoMessage() {} +func (*ChangeStoreSliceUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_2b02bba284ea1e46, []int{0, 19} +} +func (m *ChangeStoreSliceUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChangeStoreSliceUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChangeStoreSliceUpdate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ChangeStoreSliceUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChangeStoreSliceUpdate.Merge(m, src) +} +func (m *ChangeStoreSliceUpdate) XXX_Size() int { + return m.Size() +} +func (m *ChangeStoreSliceUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_ChangeStoreSliceUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_ChangeStoreSliceUpdate proto.InternalMessageInfo + +type IsChangeStoreSliceUpdateOperation interface { + IsChangeStoreSliceUpdateOperation() + MarshalTo([]byte) (int, error) + Size() int +} + +type ChangeStoreSliceUpdateOperationOfAdd struct { + Add *ChangeStoreSliceUpdateAdd `protobuf:"bytes,2,opt,name=add,proto3,oneof" json:"add,omitempty"` +} +type ChangeStoreSliceUpdateOperationOfRemove struct { + Remove *ChangeStoreSliceUpdateRemove `protobuf:"bytes,3,opt,name=remove,proto3,oneof" json:"remove,omitempty"` +} +type ChangeStoreSliceUpdateOperationOfMove struct { + Move *ChangeStoreSliceUpdateMove `protobuf:"bytes,4,opt,name=move,proto3,oneof" json:"move,omitempty"` +} + +func (*ChangeStoreSliceUpdateOperationOfAdd) IsChangeStoreSliceUpdateOperation() {} +func (*ChangeStoreSliceUpdateOperationOfRemove) IsChangeStoreSliceUpdateOperation() {} +func (*ChangeStoreSliceUpdateOperationOfMove) IsChangeStoreSliceUpdateOperation() {} + +func (m *ChangeStoreSliceUpdate) GetOperation() IsChangeStoreSliceUpdateOperation { + if m != nil { + return m.Operation + } + return nil +} + +func (m *ChangeStoreSliceUpdate) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *ChangeStoreSliceUpdate) GetAdd() *ChangeStoreSliceUpdateAdd { + if x, ok := m.GetOperation().(*ChangeStoreSliceUpdateOperationOfAdd); ok { + return x.Add + } + return nil +} + +func (m *ChangeStoreSliceUpdate) GetRemove() *ChangeStoreSliceUpdateRemove { + if x, ok := m.GetOperation().(*ChangeStoreSliceUpdateOperationOfRemove); ok { + return x.Remove + } + return nil +} + +func (m *ChangeStoreSliceUpdate) GetMove() *ChangeStoreSliceUpdateMove { + if x, ok := m.GetOperation().(*ChangeStoreSliceUpdateOperationOfMove); ok { + return x.Move + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ChangeStoreSliceUpdate) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ChangeStoreSliceUpdateOperationOfAdd)(nil), + (*ChangeStoreSliceUpdateOperationOfRemove)(nil), + (*ChangeStoreSliceUpdateOperationOfMove)(nil), + } +} + +type ChangeStoreSliceUpdateAdd struct { + AfterId string `protobuf:"bytes,1,opt,name=afterId,proto3" json:"afterId,omitempty"` + Ids []string `protobuf:"bytes,2,rep,name=ids,proto3" json:"ids,omitempty"` +} + +func (m *ChangeStoreSliceUpdateAdd) Reset() { *m = ChangeStoreSliceUpdateAdd{} } +func (m *ChangeStoreSliceUpdateAdd) String() string { return proto.CompactTextString(m) } +func (*ChangeStoreSliceUpdateAdd) ProtoMessage() {} +func (*ChangeStoreSliceUpdateAdd) Descriptor() ([]byte, []int) { + return fileDescriptor_2b02bba284ea1e46, []int{0, 19, 0} +} +func (m *ChangeStoreSliceUpdateAdd) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChangeStoreSliceUpdateAdd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChangeStoreSliceUpdateAdd.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ChangeStoreSliceUpdateAdd) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChangeStoreSliceUpdateAdd.Merge(m, src) +} +func (m *ChangeStoreSliceUpdateAdd) XXX_Size() int { + return m.Size() +} +func (m *ChangeStoreSliceUpdateAdd) XXX_DiscardUnknown() { + xxx_messageInfo_ChangeStoreSliceUpdateAdd.DiscardUnknown(m) +} + +var xxx_messageInfo_ChangeStoreSliceUpdateAdd proto.InternalMessageInfo + +func (m *ChangeStoreSliceUpdateAdd) GetAfterId() string { + if m != nil { + return m.AfterId + } + return "" +} + +func (m *ChangeStoreSliceUpdateAdd) GetIds() []string { + if m != nil { + return m.Ids + } + return nil +} + +type ChangeStoreSliceUpdateRemove struct { + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` +} + +func (m *ChangeStoreSliceUpdateRemove) Reset() { *m = ChangeStoreSliceUpdateRemove{} } +func (m *ChangeStoreSliceUpdateRemove) String() string { return proto.CompactTextString(m) } +func (*ChangeStoreSliceUpdateRemove) ProtoMessage() {} +func (*ChangeStoreSliceUpdateRemove) Descriptor() ([]byte, []int) { + return fileDescriptor_2b02bba284ea1e46, []int{0, 19, 1} +} +func (m *ChangeStoreSliceUpdateRemove) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChangeStoreSliceUpdateRemove) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChangeStoreSliceUpdateRemove.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ChangeStoreSliceUpdateRemove) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChangeStoreSliceUpdateRemove.Merge(m, src) +} +func (m *ChangeStoreSliceUpdateRemove) XXX_Size() int { + return m.Size() +} +func (m *ChangeStoreSliceUpdateRemove) XXX_DiscardUnknown() { + xxx_messageInfo_ChangeStoreSliceUpdateRemove.DiscardUnknown(m) +} + +var xxx_messageInfo_ChangeStoreSliceUpdateRemove proto.InternalMessageInfo + +func (m *ChangeStoreSliceUpdateRemove) GetIds() []string { + if m != nil { + return m.Ids + } + return nil +} + +type ChangeStoreSliceUpdateMove struct { + AfterId string `protobuf:"bytes,1,opt,name=afterId,proto3" json:"afterId,omitempty"` + Ids []string `protobuf:"bytes,2,rep,name=ids,proto3" json:"ids,omitempty"` +} + +func (m *ChangeStoreSliceUpdateMove) Reset() { *m = ChangeStoreSliceUpdateMove{} } +func (m *ChangeStoreSliceUpdateMove) String() string { return proto.CompactTextString(m) } +func (*ChangeStoreSliceUpdateMove) ProtoMessage() {} +func (*ChangeStoreSliceUpdateMove) Descriptor() ([]byte, []int) { + return fileDescriptor_2b02bba284ea1e46, []int{0, 19, 2} +} +func (m *ChangeStoreSliceUpdateMove) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChangeStoreSliceUpdateMove) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChangeStoreSliceUpdateMove.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ChangeStoreSliceUpdateMove) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChangeStoreSliceUpdateMove.Merge(m, src) +} +func (m *ChangeStoreSliceUpdateMove) XXX_Size() int { + return m.Size() +} +func (m *ChangeStoreSliceUpdateMove) XXX_DiscardUnknown() { + xxx_messageInfo_ChangeStoreSliceUpdateMove.DiscardUnknown(m) +} + +var xxx_messageInfo_ChangeStoreSliceUpdateMove proto.InternalMessageInfo + +func (m *ChangeStoreSliceUpdateMove) GetAfterId() string { + if m != nil { + return m.AfterId + } + return "" +} + +func (m *ChangeStoreSliceUpdateMove) GetIds() []string { + if m != nil { + return m.Ids + } + return nil +} + func init() { proto.RegisterType((*Change)(nil), "anytype.Change") proto.RegisterType((*ChangeSnapshot)(nil), "anytype.Change.Snapshot") @@ -1496,90 +1755,100 @@ func init() { proto.RegisterType((*ChangeObjectTypeRemove)(nil), "anytype.Change.ObjectTypeRemove") proto.RegisterType((*ChangeStoreKeySet)(nil), "anytype.Change.StoreKeySet") proto.RegisterType((*ChangeStoreKeyUnset)(nil), "anytype.Change.StoreKeyUnset") + proto.RegisterType((*ChangeStoreSliceUpdate)(nil), "anytype.Change.StoreSliceUpdate") + proto.RegisterType((*ChangeStoreSliceUpdateAdd)(nil), "anytype.Change.StoreSliceUpdate.Add") + proto.RegisterType((*ChangeStoreSliceUpdateRemove)(nil), "anytype.Change.StoreSliceUpdate.Remove") + proto.RegisterType((*ChangeStoreSliceUpdateMove)(nil), "anytype.Change.StoreSliceUpdate.Move") } func init() { proto.RegisterFile("pb/protos/changes.proto", fileDescriptor_2b02bba284ea1e46) } var fileDescriptor_2b02bba284ea1e46 = []byte{ - // 1241 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4d, 0x6f, 0xdb, 0x46, - 0x10, 0x15, 0x2d, 0x59, 0x1f, 0x43, 0x5b, 0x71, 0x16, 0x86, 0xcd, 0x32, 0xae, 0xa2, 0x24, 0x6e, - 0x21, 0xb4, 0x01, 0x85, 0xca, 0x45, 0x53, 0xa7, 0x29, 0x8a, 0xc8, 0x1f, 0x95, 0x11, 0xbb, 0x36, - 0xd6, 0x4d, 0x0f, 0xbd, 0x18, 0x94, 0xb8, 0x96, 0x18, 0x51, 0x24, 0x41, 0xae, 0x0c, 0xe8, 0x57, - 0xb4, 0xe8, 0x0f, 0xea, 0xb9, 0xc7, 0xdc, 0xda, 0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0x6a, 0xc5, 0x66, - 0xb1, 0xa5, 0x76, 0x36, 0x0d, 0x51, 0xba, 0x11, 0xa5, 0x66, 0xec, 0x45, 0x8f, 0x71, 0x8c, 0x43, - 0x9f, 0x43, 0x35, 0xce, 0x41, 0x2b, 0x35, 0x95, 0x96, 0xda, 0xd1, 0xe6, 0x39, 0x71, 0x32, 0x38, - 0x41, 0x32, 0xd6, 0xa5, 0xed, 0x90, 0x57, 0x64, 0x16, 0x6a, 0x65, 0xbe, 0xd3, 0x2d, 0xd6, 0xa1, - 0x78, 0x8e, 0x13, 0x24, 0xda, 0x82, 0x1a, 0xb5, 0x27, 0x24, 0xa4, 0xe6, 0xc4, 0xd7, 0x2a, 0x4d, - 0xa5, 0x55, 0xc4, 0xe9, 0x02, 0xd2, 0xa0, 0x72, 0x45, 0x82, 0xd0, 0xf6, 0x5c, 0xad, 0xca, 0x3b, - 0x11, 0x87, 0xfa, 0xdf, 0x0a, 0x54, 0xe3, 0x24, 0x50, 0x17, 0xaa, 0x8e, 0x37, 0xec, 0x11, 0x53, - 0x34, 0x56, 0xed, 0x7c, 0xbc, 0x28, 0x61, 0xe3, 0x58, 0x00, 0x0f, 0x5c, 0x1a, 0xcc, 0x70, 0xc2, - 0x43, 0xbb, 0x50, 0xb2, 0x4c, 0x6a, 0xf2, 0x8e, 0xab, 0x9d, 0x8f, 0x12, 0x3e, 0x1f, 0x03, 0xe3, - 0x7c, 0x62, 0x06, 0xb4, 0xeb, 0x78, 0x83, 0x71, 0x2c, 0xd4, 0x35, 0x43, 0x82, 0x39, 0x25, 0x53, - 0x79, 0xf1, 0xdf, 0x56, 0xae, 0x7f, 0x05, 0xab, 0x99, 0x5c, 0xd0, 0x1a, 0x14, 0xc7, 0x64, 0xa6, - 0x29, 0xbc, 0x50, 0xf6, 0x13, 0xad, 0xc3, 0xf2, 0x95, 0xe9, 0x4c, 0x89, 0x18, 0x83, 0x28, 0x78, - 0xbe, 0xf4, 0xa5, 0xa2, 0xff, 0xa4, 0x40, 0x35, 0xd6, 0x44, 0x08, 0x4a, 0x23, 0x33, 0x1c, 0x09, - 0x26, 0xff, 0x8d, 0xbe, 0x80, 0xd2, 0x98, 0xe5, 0xb3, 0xc4, 0xf3, 0x79, 0xbc, 0x28, 0x1f, 0x83, - 0xfd, 0x89, 0x5a, 0xc1, 0xf1, 0xfa, 0x33, 0xa8, 0x25, 0x4b, 0xef, 0x95, 0xd1, 0x5f, 0x55, 0xa8, - 0x88, 0x49, 0x42, 0xdf, 0x80, 0xda, 0x67, 0xbd, 0xda, 0x0b, 0x88, 0x49, 0x09, 0xe7, 0xab, 0x9d, - 0x07, 0xf3, 0x39, 0x74, 0x53, 0x48, 0xaf, 0x80, 0x65, 0x46, 0x22, 0xf0, 0xda, 0xb7, 0x98, 0xc0, - 0xd2, 0x3b, 0x04, 0x22, 0x48, 0x22, 0x10, 0x85, 0x89, 0x00, 0x26, 0x13, 0xef, 0x8a, 0x68, 0xc5, - 0x77, 0x08, 0x44, 0x90, 0x44, 0x20, 0x0a, 0xd1, 0x2e, 0xd4, 0x78, 0x78, 0xc2, 0xe8, 0xd1, 0x47, - 0xf0, 0x41, 0x2e, 0xfd, 0x24, 0x22, 0xa7, 0x68, 0xd4, 0x83, 0x3a, 0x0f, 0xf6, 0xa7, 0xbe, 0x63, - 0x0f, 0x58, 0xfe, 0xcb, 0x9c, 0xdf, 0xc8, 0xe5, 0x27, 0xa8, 0x5e, 0x01, 0xcf, 0xf1, 0x58, 0x15, - 0x01, 0x71, 0x4c, 0x6a, 0x7b, 0xee, 0x4b, 0xcb, 0xd2, 0x3a, 0xf9, 0x55, 0xe0, 0x14, 0xc2, 0xaa, - 0x90, 0x18, 0x2c, 0x95, 0x38, 0x14, 0x9d, 0xd8, 0xc9, 0x4f, 0x05, 0x67, 0x50, 0x2c, 0x95, 0x2c, - 0x0f, 0xbd, 0x00, 0xb0, 0x08, 0x35, 0x6d, 0x27, 0x3c, 0x27, 0x54, 0xb3, 0xb8, 0x8a, 0x3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 0x39, 0xa8, 0x53, 0x50, 0x25, 0x5b, 0x67, 0x57, 0x4e, 0xdf, 0xa4, 0x23, 0x91, 0x20, 0xff, 0xfd, - 0x9e, 0x5f, 0xe1, 0x13, 0x58, 0xcd, 0x98, 0x7c, 0x9e, 0x64, 0x77, 0xeb, 0xb7, 0xeb, 0x86, 0xf2, - 0xf6, 0xba, 0xa1, 0xfc, 0x79, 0xdd, 0x50, 0x7e, 0xbe, 0x69, 0x14, 0xde, 0xde, 0x34, 0x0a, 0x7f, - 0xdc, 0x34, 0x0a, 0x3f, 0x2e, 0xf9, 0xfd, 0x7e, 0x99, 0x2b, 0xef, 0xfc, 0x13, 0x00, 0x00, 0xff, - 0xff, 0xc0, 0x28, 0xf3, 0xd5, 0xe5, 0x0d, 0x00, 0x00, + // 1344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6e, 0xdb, 0xc6, + 0x13, 0x16, 0x45, 0x59, 0x96, 0x86, 0xb6, 0xe3, 0x2c, 0x82, 0x84, 0x3f, 0xc6, 0x51, 0x94, 0xc4, + 0xf9, 0x55, 0x68, 0x03, 0x0a, 0x51, 0x8a, 0xe6, 0x6f, 0x51, 0x44, 0x4e, 0x52, 0x05, 0x89, 0xeb, + 0x60, 0xd5, 0xf4, 0xd0, 0x8b, 0xb1, 0x12, 0xd7, 0x32, 0x63, 0x4a, 0x24, 0xc8, 0x95, 0x01, 0x3d, + 0x45, 0x8b, 0xbe, 0x52, 0x2f, 0x3d, 0xe6, 0xd6, 0x1e, 0x8b, 0x04, 0xbd, 0xf6, 0x09, 0x7a, 0x28, + 0x76, 0xb9, 0x24, 0x97, 0x0c, 0x15, 0xd5, 0x87, 0xf6, 0x62, 0x73, 0x76, 0xbf, 0xef, 0xdb, 0x99, + 0xd9, 0xd1, 0xcc, 0xc2, 0xa5, 0x60, 0xd4, 0x0d, 0x42, 0x9f, 0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ad, 0x3f, 0xab, 0xb0, 0x5d, 0x1c, 0x08, 0x25, 0xe5, 0x7b, 0x0f, 0x74, 0xe2, + 0x38, 0xf2, 0xdc, 0xdd, 0x55, 0x13, 0xc5, 0x8e, 0x47, 0x2f, 0xa7, 0xa0, 0xc7, 0x50, 0x0f, 0xd5, + 0x27, 0xe7, 0x27, 0x2b, 0xc9, 0xe9, 0xb4, 0x95, 0x44, 0xf4, 0x10, 0x6a, 0xd3, 0xec, 0xd1, 0x79, + 0x73, 0xa5, 0x80, 0x7c, 0x80, 0x0a, 0x92, 0x75, 0x1b, 0x74, 0x7e, 0x2b, 0x26, 0xac, 0x93, 0x23, + 0x46, 0xc3, 0xb4, 0x91, 0x26, 0x66, 0xd2, 0x0c, 0xab, 0x59, 0x33, 0xb4, 0xa0, 0xbe, 0x74, 0x32, + 0xf4, 0xa0, 0x26, 0x86, 0xc2, 0x19, 0xf4, 0xfa, 0x06, 0x34, 0xfd, 0x80, 0x86, 0xa2, 0x8e, 0xfa, + 0x3b, 0xbf, 0xbc, 0x6b, 0x69, 0x6f, 0xdf, 0xb5, 0xb4, 0xdf, 0xdf, 0xb5, 0xb4, 0x1f, 0xdf, 0xb7, + 0x2a, 0x6f, 0xdf, 0xb7, 0x2a, 0xbf, 0xbd, 0x6f, 0x55, 0xbe, 0xaf, 0x06, 0xa3, 0x51, 0x5d, 0x5c, + 0xe5, 0x9d, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x42, 0x7c, 0xda, 0xe8, 0x8c, 0x0f, 0x00, 0x00, } func (m *Change) Marshal() (dAtA []byte, err error) { @@ -1602,13 +1871,6 @@ func (m *Change) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintChanges(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0x42 - } if m.Timestamp != 0 { i = encodeVarintChanges(dAtA, i, uint64(m.Timestamp)) i-- @@ -2189,6 +2451,29 @@ func (m *ChangeContentValueOfStoreKeyUnset) MarshalToSizedBuffer(dAtA []byte) (i } return len(dAtA) - i, nil } +func (m *ChangeContentValueOfStoreSliceUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeContentValueOfStoreSliceUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.StoreSliceUpdate != nil { + { + size, err := m.StoreSliceUpdate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintChanges(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0xea + } + return len(dAtA) - i, nil +} func (m *ChangeBlockCreate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2951,6 +3236,218 @@ func (m *ChangeStoreKeyUnset) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ChangeStoreSliceUpdate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChangeStoreSliceUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeStoreSliceUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Operation != nil { + { + size := m.Operation.Size() + i -= size + if _, err := m.Operation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintChanges(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ChangeStoreSliceUpdateOperationOfAdd) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeStoreSliceUpdateOperationOfAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Add != nil { + { + size, err := m.Add.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintChanges(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *ChangeStoreSliceUpdateOperationOfRemove) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeStoreSliceUpdateOperationOfRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Remove != nil { + { + size, err := m.Remove.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintChanges(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *ChangeStoreSliceUpdateOperationOfMove) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeStoreSliceUpdateOperationOfMove) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Move != nil { + { + size, err := m.Move.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintChanges(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + return len(dAtA) - i, nil +} +func (m *ChangeStoreSliceUpdateAdd) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChangeStoreSliceUpdateAdd) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeStoreSliceUpdateAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Ids) > 0 { + for iNdEx := len(m.Ids) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Ids[iNdEx]) + copy(dAtA[i:], m.Ids[iNdEx]) + i = encodeVarintChanges(dAtA, i, uint64(len(m.Ids[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.AfterId) > 0 { + i -= len(m.AfterId) + copy(dAtA[i:], m.AfterId) + i = encodeVarintChanges(dAtA, i, uint64(len(m.AfterId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ChangeStoreSliceUpdateRemove) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChangeStoreSliceUpdateRemove) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeStoreSliceUpdateRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Ids) > 0 { + for iNdEx := len(m.Ids) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Ids[iNdEx]) + copy(dAtA[i:], m.Ids[iNdEx]) + i = encodeVarintChanges(dAtA, i, uint64(len(m.Ids[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ChangeStoreSliceUpdateMove) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChangeStoreSliceUpdateMove) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChangeStoreSliceUpdateMove) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Ids) > 0 { + for iNdEx := len(m.Ids) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Ids[iNdEx]) + copy(dAtA[i:], m.Ids[iNdEx]) + i = encodeVarintChanges(dAtA, i, uint64(len(m.Ids[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.AfterId) > 0 { + i -= len(m.AfterId) + copy(dAtA[i:], m.AfterId) + i = encodeVarintChanges(dAtA, i, uint64(len(m.AfterId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintChanges(dAtA []byte, offset int, v uint64) int { offset -= sovChanges(v) base := offset @@ -3003,10 +3500,6 @@ func (m *Change) Size() (n int) { if m.Timestamp != 0 { n += 1 + sovChanges(uint64(m.Timestamp)) } - l = len(m.Version) - if l > 0 { - n += 1 + l + sovChanges(uint64(l)) - } return n } @@ -3262,6 +3755,18 @@ func (m *ChangeContentValueOfStoreKeyUnset) Size() (n int) { } return n } +func (m *ChangeContentValueOfStoreSliceUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StoreSliceUpdate != nil { + l = m.StoreSliceUpdate.Size() + n += 2 + l + sovChanges(uint64(l)) + } + return n +} func (m *ChangeBlockCreate) Size() (n int) { if m == nil { return 0 @@ -3614,6 +4119,111 @@ func (m *ChangeStoreKeyUnset) Size() (n int) { return n } +func (m *ChangeStoreSliceUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovChanges(uint64(l)) + } + if m.Operation != nil { + n += m.Operation.Size() + } + return n +} + +func (m *ChangeStoreSliceUpdateOperationOfAdd) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Add != nil { + l = m.Add.Size() + n += 1 + l + sovChanges(uint64(l)) + } + return n +} +func (m *ChangeStoreSliceUpdateOperationOfRemove) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Remove != nil { + l = m.Remove.Size() + n += 1 + l + sovChanges(uint64(l)) + } + return n +} +func (m *ChangeStoreSliceUpdateOperationOfMove) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Move != nil { + l = m.Move.Size() + n += 1 + l + sovChanges(uint64(l)) + } + return n +} +func (m *ChangeStoreSliceUpdateAdd) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AfterId) + if l > 0 { + n += 1 + l + sovChanges(uint64(l)) + } + if len(m.Ids) > 0 { + for _, s := range m.Ids { + l = len(s) + n += 1 + l + sovChanges(uint64(l)) + } + } + return n +} + +func (m *ChangeStoreSliceUpdateRemove) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Ids) > 0 { + for _, s := range m.Ids { + l = len(s) + n += 1 + l + sovChanges(uint64(l)) + } + } + return n +} + +func (m *ChangeStoreSliceUpdateMove) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AfterId) + if l > 0 { + n += 1 + l + sovChanges(uint64(l)) + } + if len(m.Ids) > 0 { + for _, s := range m.Ids { + l = len(s) + n += 1 + l + sovChanges(uint64(l)) + } + } + return n +} + func sovChanges(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3868,38 +4478,6 @@ func (m *Change) Unmarshal(dAtA []byte) error { break } } - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowChanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthChanges - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthChanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipChanges(dAtA[iNdEx:]) @@ -4966,6 +5544,41 @@ func (m *ChangeContent) Unmarshal(dAtA []byte) error { } m.Value = &ChangeContentValueOfStoreKeyUnset{v} iNdEx = postIndex + case 109: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StoreSliceUpdate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ChangeStoreSliceUpdate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &ChangeContentValueOfStoreSliceUpdate{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipChanges(dAtA[iNdEx:]) @@ -6878,6 +7491,503 @@ func (m *ChangeStoreKeyUnset) Unmarshal(dAtA []byte) error { } return nil } +func (m *ChangeStoreSliceUpdate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StoreSliceUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreSliceUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Add", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ChangeStoreSliceUpdateAdd{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Operation = &ChangeStoreSliceUpdateOperationOfAdd{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Remove", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ChangeStoreSliceUpdateRemove{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Operation = &ChangeStoreSliceUpdateOperationOfRemove{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Move", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ChangeStoreSliceUpdateMove{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Operation = &ChangeStoreSliceUpdateOperationOfMove{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipChanges(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthChanges + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChangeStoreSliceUpdateAdd) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Add: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Add: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AfterId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AfterId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ids", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ids = append(m.Ids, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipChanges(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthChanges + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChangeStoreSliceUpdateRemove) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Remove: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Remove: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ids", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ids = append(m.Ids, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipChanges(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthChanges + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChangeStoreSliceUpdateMove) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Move: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Move: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AfterId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AfterId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ids", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthChanges + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthChanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ids = append(m.Ids, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipChanges(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthChanges + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipChanges(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/pb/protos/changes.proto b/pb/protos/changes.proto index b91329eff..7941580e9 100644 --- a/pb/protos/changes.proto +++ b/pb/protos/changes.proto @@ -61,6 +61,7 @@ message Change { StoreKeySet storeKeySet = 107; StoreKeyUnset storeKeyUnset = 108; + StoreSliceUpdate storeSliceUpdate = 109; } } @@ -151,4 +152,27 @@ message Change { message StoreKeyUnset { repeated string path = 1; } + + message StoreSliceUpdate { + string key = 1; + oneof operation { + Add add = 2; + Remove remove = 3; + Move move = 4; + } + + message Add { + string afterId = 1; + repeated string ids = 2; + } + + message Remove { + repeated string ids = 1; + } + + message Move { + string afterId = 1; + repeated string ids = 2; + } + } } diff --git a/util/slice/diff.go b/util/slice/diff.go index b8ed7d91f..cc582356d 100644 --- a/util/slice/diff.go +++ b/util/slice/diff.go @@ -292,3 +292,28 @@ func ApplyChanges[T any](origin []T, changes []Change[T], getID func(T) string) return res } + +func UnwrapChanges[T, R any]( + changes []Change[T], + add func(afterID string, items []T) R, + remove func(ids []string) R, + move func(afterID string, ids []string) R, + update func(id string, item T) R, +) []R { + res := make([]R, 0, len(changes)) + for _, c := range changes { + if v := c.Add(); v != nil { + res = append(res, add(v.AfterID, v.Items)) + } + if v := c.Remove(); v != nil { + res = append(res, remove(v.IDs)) + } + if v := c.Move(); v != nil { + res = append(res, move(v.AfterID, v.IDs)) + } + if v := c.Replace(); v != nil { + res = append(res, update(v.ID, v.Item)) + } + } + return res +}