Skip to content

Commit

Permalink
accept quad.Value instead of graph.Value for RemoveNode; fix #607
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc committed May 26, 2017
1 parent 7323095 commit b3e18e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion graph/quadwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ type QuadWriter interface {
ApplyTransaction(*Transaction) error

// RemoveNode removes all quads which have the given node as subject, predicate, object, or label.
RemoveNode(Value) error
RemoveNode(quad.Value) error

// Close cleans up replication and closes the writing aspect of the database.
Close() error
Expand Down
8 changes: 6 additions & 2 deletions writer/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ func (s *Single) RemoveQuad(q quad.Quad) error {
}

// RemoveNode removes all quads with the given value
func (s *Single) RemoveNode(v graph.Value) error {
func (s *Single) RemoveNode(v quad.Value) error {
gv := s.qs.ValueOf(v)
if gv == nil {
return nil
}
var deltas []graph.Delta
// TODO(dennwc): QuadStore may remove node without iterations. Consider optional interface for this.
for _, d := range []quad.Direction{quad.Subject, quad.Predicate, quad.Object, quad.Label} {
it := s.qs.QuadIterator(d, v)
it := s.qs.QuadIterator(d, gv)
for it.Next() {
deltas = append(deltas, graph.Delta{
ID: s.currentID.Next(),
Expand Down

0 comments on commit b3e18e8

Please sign in to comment.