@@ -506,7 +506,7 @@ func (qs *QuadStore) applyAddDeltas(ctx context.Context, tx kv.Tx, in []graph.De
506
506
}
507
507
deltas .IncNode = nil
508
508
// resolve and insert all new quads
509
- links := make ([]cproto.Primitive , 0 , len (deltas .QuadAdd ))
509
+ links := make ([]* cproto.Primitive , 0 , len (deltas .QuadAdd ))
510
510
qadd := make (map [[4 ]uint64 ]struct {}, len (deltas .QuadAdd ))
511
511
for _ , q := range deltas .QuadAdd {
512
512
var link cproto.Primitive
@@ -541,7 +541,7 @@ func (qs *QuadStore) applyAddDeltas(ctx context.Context, tx kv.Tx, in []graph.De
541
541
return nil , err
542
542
}
543
543
}
544
- links = append (links , link )
544
+ links = append (links , & link )
545
545
}
546
546
qadd = nil
547
547
deltas .QuadAdd = nil
@@ -585,7 +585,7 @@ func (qs *QuadStore) ApplyDeltas(in []graph.Delta, ignoreOpts graph.IgnoreOpts)
585
585
}
586
586
587
587
if len (deltas .QuadDel ) != 0 || len (deltas .DecNode ) != 0 {
588
- links := make ([]cproto.Primitive , 0 , len (deltas .QuadDel ))
588
+ links := make ([]* cproto.Primitive , 0 , len (deltas .QuadDel ))
589
589
// resolve all nodes that will be removed
590
590
dnodes := make (map [refs.ValueHash ]uint64 , len (deltas .DecNode ))
591
591
if err := qs .resolveValDeltas (ctx , tx , deltas .DecNode , func (i int , id uint64 ) {
@@ -597,7 +597,7 @@ func (qs *QuadStore) ApplyDeltas(in []graph.Delta, ignoreOpts graph.IgnoreOpts)
597
597
// check for existence and delete quads
598
598
fixNodes := make (map [refs.ValueHash ]int )
599
599
for _ , q := range deltas .QuadDel {
600
- var link cproto.Primitive
600
+ link := new ( cproto.Primitive )
601
601
exists := true
602
602
// resolve values of all quad directions
603
603
// if any of the direction does not exists, the quad does not exists as well
@@ -616,13 +616,13 @@ func (qs *QuadStore) ApplyDeltas(in []graph.Delta, ignoreOpts graph.IgnoreOpts)
616
616
link .SetDirection (dir , n .ID )
617
617
}
618
618
if exists {
619
- p , err := qs .hasPrimitive (ctx , tx , & link , true )
619
+ p , err := qs .hasPrimitive (ctx , tx , link , true )
620
620
if err != nil {
621
621
return err
622
622
} else if p == nil || p .Deleted {
623
623
exists = false
624
624
} else {
625
- link = * p
625
+ link = p
626
626
}
627
627
}
628
628
if ! exists {
@@ -692,9 +692,9 @@ func (qs *QuadStore) indexNode(ctx context.Context, tx kv.Tx, p *cproto.Primitiv
692
692
return qs .addToLog (ctx , tx , p )
693
693
}
694
694
695
- func (qs * QuadStore ) indexLinks (ctx context.Context , tx kv.Tx , links []cproto.Primitive ) error {
695
+ func (qs * QuadStore ) indexLinks (ctx context.Context , tx kv.Tx , links []* cproto.Primitive ) error {
696
696
for _ , p := range links {
697
- if err := qs .indexLink (ctx , tx , & p ); err != nil {
697
+ if err := qs .indexLink (ctx , tx , p ); err != nil {
698
698
return err
699
699
}
700
700
}
@@ -730,9 +730,9 @@ func (qs *QuadStore) delLog(ctx context.Context, tx kv.Tx, id uint64) error {
730
730
return tx .Del (ctx , logIndex .Append (uint64KeyBytes (id )))
731
731
}
732
732
733
- func (qs * QuadStore ) markLinksDead (ctx context.Context , tx kv.Tx , links []cproto.Primitive ) error {
733
+ func (qs * QuadStore ) markLinksDead (ctx context.Context , tx kv.Tx , links []* cproto.Primitive ) error {
734
734
for _ , p := range links {
735
- if err := qs .markAsDead (ctx , tx , & p ); err != nil {
735
+ if err := qs .markAsDead (ctx , tx , p ); err != nil {
736
736
return err
737
737
}
738
738
}
0 commit comments