Copy refs and comment on Value

This commit is contained in:
Barak Michener 2014-08-06 14:37:37 -04:00
parent cedaa9cdfa
commit 2bec255b52
2 changed files with 12 additions and 3 deletions

View file

@ -95,6 +95,12 @@ func (it *Materialize) TagResults(dst map[string]graph.Value) {
func (it *Materialize) Clone() graph.Iterator {
out := NewMaterialize(it.subIt.Clone())
out.tags.CopyFrom(it)
if it.hasRun {
out.hasRun = true
out.aborted = it.aborted
out.values = it.values
out.containsMap = it.containsMap
}
return out
}

View file

@ -28,14 +28,17 @@ import (
"github.com/google/cayley/quad"
)
// Defines an opaque "triple store value" type. However the backend wishes to
// implement it, a Value is merely a token to a triple or a node that the backing
// store itself understands, and the base iterators pass around.
// Value defines an opaque "triple store value" type. However the backend wishes
// to implement it, a Value is merely a token to a triple or a node that the
// backing store itself understands, and the base iterators pass around.
//
// For example, in a very traditional, graphd-style graph, these are int64s
// (guids of the primitives). In a very direct sort of graph, these could be
// pointers to structs, or merely triples, or whatever works best for the
// backing store.
//
// These must be comparable, ie, not arrays or maps, as they may be used as keys
// for maps.
type Value interface{}
type TripleStore interface {