comments and concretized deltas

This commit is contained in:
Barak Michener 2014-08-14 01:23:04 -04:00
parent fe0569c9d4
commit f967b36f84
9 changed files with 31 additions and 35 deletions

View file

@ -35,17 +35,17 @@ func NewMemstoreNodesAllIterator(ts *TripleStore) *NodesAllIterator {
}
// No subiterators.
func (nit *NodesAllIterator) SubIterators() []graph.Iterator {
func (it *NodesAllIterator) SubIterators() []graph.Iterator {
return nil
}
func (nit *NodesAllIterator) Next() bool {
if !nit.Int64.Next() {
func (it *NodesAllIterator) Next() bool {
if !it.Int64.Next() {
return false
}
_, ok := nit.ts.revIdMap[nit.Int64.Result().(int64)]
_, ok := it.ts.revIdMap[it.Int64.Result().(int64)]
if !ok {
return nit.Next()
return it.Next()
}
return true
}

View file

@ -105,7 +105,7 @@ func newTripleStore() *TripleStore {
return &ts
}
func (ts *TripleStore) ApplyDeltas(deltas []*graph.Delta) error {
func (ts *TripleStore) ApplyDeltas(deltas []graph.Delta) error {
for _, d := range deltas {
var err error
if d.Action == graph.Add {
@ -154,13 +154,13 @@ func (ts *TripleStore) quadExists(t quad.Quad) (bool, int64) {
return false, 0
}
func (ts *TripleStore) AddDelta(d *graph.Delta) error {
func (ts *TripleStore) AddDelta(d graph.Delta) error {
if exists, _ := ts.quadExists(d.Quad); exists {
return graph.ErrQuadExists
}
var quadID int64
quadID = ts.quadIdCounter
ts.log = append(ts.log, LogEntry{Delta: *d})
ts.log = append(ts.log, LogEntry{Delta: d})
ts.size++
ts.quadIdCounter++
@ -189,7 +189,7 @@ func (ts *TripleStore) AddDelta(d *graph.Delta) error {
return nil
}
func (ts *TripleStore) RemoveDelta(d *graph.Delta) error {
func (ts *TripleStore) RemoveDelta(d graph.Delta) error {
var prevQuadID int64
var exists bool
prevQuadID = 0
@ -199,7 +199,7 @@ func (ts *TripleStore) RemoveDelta(d *graph.Delta) error {
var quadID int64
quadID = ts.quadIdCounter
ts.log = append(ts.log, LogEntry{Delta: *d})
ts.log = append(ts.log, LogEntry{Delta: d})
ts.log[prevQuadID].DeletedBy = quadID
ts.size--
ts.quadIdCounter++