Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/tree/sharedEntryAttributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ func (s *sharedEntryAttributes) remainsToExist() bool {
// getRegularDeletes performs deletion calculation on elements that have a schema attached.
func (s *sharedEntryAttributes) getRegularDeletes(deletes []types.DeleteEntry, aggregate bool) ([]types.DeleteEntry, error) {
var err error

if s.shouldDelete() && !s.IsRoot() && len(s.GetSchemaKeys()) == 0 {
return append(deletes, s), nil
}
Expand All @@ -619,7 +620,8 @@ func (s *sharedEntryAttributes) getRegularDeletes(deletes []types.DeleteEntry, a
if err != nil {
return nil, err
}
deletes = append(deletes, types.NewDeleteEntryImpl(path, append(s.Path(), elem)))
path.Elem = append(path.Elem, &sdcpb.PathElem{Name: elem})
deletes = append(deletes, types.NewDeleteEntryImpl(path))
}

for _, e := range s.childs.GetAll() {
Expand Down
7 changes: 3 additions & 4 deletions pkg/tree/types/delete_entry.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package types

import (
"github.com/sdcio/data-server/pkg/utils"
sdcpb "github.com/sdcio/sdc-protos/sdcpb"
)

Expand All @@ -12,21 +13,19 @@ type DeleteEntry interface {
// DeleteEntryImpl is a crutch to flag oldbestcases if on a choice, the active case changed
type DeleteEntryImpl struct {
sdcpbPath *sdcpb.Path
pathslice PathSlice
}

func NewDeleteEntryImpl(sdcpbPath *sdcpb.Path, pathslice PathSlice) *DeleteEntryImpl {
func NewDeleteEntryImpl(sdcpbPath *sdcpb.Path) *DeleteEntryImpl {
return &DeleteEntryImpl{
sdcpbPath: sdcpbPath,
pathslice: pathslice,
}
}

func (d *DeleteEntryImpl) SdcpbPath() (*sdcpb.Path, error) {
return d.sdcpbPath, nil
}
func (d *DeleteEntryImpl) Path() PathSlice {
return d.pathslice
return utils.ToStrings(d.sdcpbPath, false, false)
}

type DeleteEntriesList []DeleteEntry
Expand Down
Loading