Skip to content

Commit 336e5be

Browse files
committed
add missing link to process explicit deletes via grpc
1 parent 189bd39 commit 336e5be

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

pkg/datastore/transaction_rpc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
treeproto "github.com/sdcio/data-server/pkg/tree/importer/proto"
1313
"github.com/sdcio/data-server/pkg/tree/tree_persist"
1414
treetypes "github.com/sdcio/data-server/pkg/tree/types"
15-
"github.com/sdcio/data-server/pkg/utils"
1615
sdcpb "github.com/sdcio/sdc-protos/sdcpb"
1716
log "github.com/sirupsen/logrus"
1817
)
@@ -47,9 +46,7 @@ func (d *Datastore) SdcpbTransactionIntentToInternalTI(ctx context.Context, req
4746
ti.AddUpdates(Updates)
4847

4948
// add the deletes
50-
for _, d := range req.Deletes {
51-
ti.AddDelete(utils.ToStrings(d, false, false))
52-
}
49+
ti.AddDeletes(req.Deletes)
5350

5451
return ti, nil
5552
}
@@ -203,6 +200,9 @@ func (d *Datastore) lowlevelTransactionSet(ctx context.Context, transaction *typ
203200
return nil, err
204201
}
205202

203+
// add the explicit delete entries
204+
root.AddExplicitDeletes(intent.GetName(), intent.GetPriority(), intent.GetDeletes())
205+
206206
// add the old intent contents paths to the involvedPaths slice
207207
involvedPaths.Join(oldIntentContent.ToPathSet())
208208
// add the new intent contents paths to the involvedPaths slice

pkg/datastore/types/transaction_intent.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package types
22

33
import (
44
treetypes "github.com/sdcio/data-server/pkg/tree/types"
5+
sdcpb "github.com/sdcio/sdc-protos/sdcpb"
56
)
67

78
type TransactionIntent struct {
@@ -15,15 +16,15 @@ type TransactionIntent struct {
1516
// it will be stored and used for change calculation but will be excluded when claculating actual deviations.
1617
deviation bool
1718
deleteIgnoreNonExisting bool
18-
deletes treetypes.PathSlices
19+
deletes *sdcpb.PathSet
1920
}
2021

2122
func NewTransactionIntent(name string, priority int32) *TransactionIntent {
2223
return &TransactionIntent{
2324
name: name,
2425
updates: make(treetypes.UpdateSlice, 0),
2526
priority: priority,
26-
deletes: make(treetypes.PathSlices, 0),
27+
deletes: sdcpb.NewPathSet(),
2728
}
2829
}
2930

@@ -43,7 +44,7 @@ func (ti *TransactionIntent) GetUpdates() treetypes.UpdateSlice {
4344
return ti.updates
4445
}
4546

46-
func (ti *TransactionIntent) GetDeletes() treetypes.PathSlices {
47+
func (ti *TransactionIntent) GetDeletes() *sdcpb.PathSet {
4748
return ti.deletes
4849
}
4950

@@ -67,6 +68,8 @@ func (ti *TransactionIntent) AddUpdate(u *treetypes.Update) {
6768
ti.updates = append(ti.updates, u)
6869
}
6970

70-
func (ti *TransactionIntent) AddDelete(p treetypes.PathSlice) {
71-
ti.deletes = append(ti.deletes, p)
71+
func (ti *TransactionIntent) AddDeletes(p []*sdcpb.Path) {
72+
for _, x := range p {
73+
ti.deletes.AddPath(x)
74+
}
7275
}

0 commit comments

Comments
 (0)