Remove graph.Err helper function
Since Err() is now a member of the Iterator interface, we don't need this helper function anymore.
This commit is contained in:
parent
745d4874e6
commit
33dd596ab4
8 changed files with 8 additions and 19 deletions
|
|
@ -177,17 +177,6 @@ func Next(it Iterator) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Err is a convenience function that conditionally calls the Err method
|
|
||||||
// of an Iterator if it is a Nexter. If the Iterator is not a Nexter, Err
|
|
||||||
// returns nil.
|
|
||||||
func Err(it Iterator) error {
|
|
||||||
if n, ok := it.(Nexter); ok {
|
|
||||||
return n.Err()
|
|
||||||
}
|
|
||||||
glog.Errorln("Calling Err on an un-nextable iterator")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Height is a convienence function to measure the height of an iterator tree.
|
// Height is a convienence function to measure the height of an iterator tree.
|
||||||
func Height(it Iterator, until Type) int {
|
func Height(it Iterator, until Type) int {
|
||||||
if it.Type() == until {
|
if it.Type() == until {
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ func (it *And) Next() bool {
|
||||||
return graph.NextLogOut(it, curr, true)
|
return graph.NextLogOut(it, curr, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := graph.Err(it.primaryIt); err != nil {
|
if err := it.primaryIt.Err(); err != nil {
|
||||||
it.err = err
|
it.err = err
|
||||||
}
|
}
|
||||||
return graph.NextLogOut(it, nil, false)
|
return graph.NextLogOut(it, nil, false)
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ func (it *HasA) Next() bool {
|
||||||
it.resultIt = &Null{}
|
it.resultIt = &Null{}
|
||||||
|
|
||||||
if !graph.Next(it.primaryIt) {
|
if !graph.Next(it.primaryIt) {
|
||||||
if err := graph.Err(it.primaryIt); err != nil {
|
if err := it.primaryIt.Err(); err != nil {
|
||||||
it.err = err
|
it.err = err
|
||||||
}
|
}
|
||||||
return graph.NextLogOut(it, 0, false)
|
return graph.NextLogOut(it, 0, false)
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ func (it *LinksTo) Next() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there's an error in the 'next' iterator, we save it and we're done.
|
// If there's an error in the 'next' iterator, we save it and we're done.
|
||||||
if err := graph.Err(it.nextIt); err != nil {
|
if err := it.nextIt.Err(); err != nil {
|
||||||
it.err = err
|
it.err = err
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ func (it *Materialize) Next() bool {
|
||||||
}
|
}
|
||||||
if it.aborted {
|
if it.aborted {
|
||||||
n := graph.Next(it.subIt)
|
n := graph.Next(it.subIt)
|
||||||
if err := graph.Err(it.subIt); err != nil {
|
if err := it.subIt.Err(); err != nil {
|
||||||
it.err = err
|
it.err = err
|
||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
|
|
@ -296,7 +296,7 @@ func (it *Materialize) materializeSet() {
|
||||||
it.actualSize += 1
|
it.actualSize += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := graph.Err(it.subIt); err != nil {
|
if err := it.subIt.Err(); err != nil {
|
||||||
it.err = err
|
it.err = err
|
||||||
} else if it.aborted {
|
} else if it.aborted {
|
||||||
if glog.V(2) {
|
if glog.V(2) {
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ func (it *Not) Next() bool {
|
||||||
return graph.NextLogOut(it, curr, true)
|
return graph.NextLogOut(it, curr, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := graph.Err(it.allIt); err != nil {
|
if err := it.allIt.Err(); err != nil {
|
||||||
it.err = err
|
it.err = err
|
||||||
}
|
}
|
||||||
return graph.NextLogOut(it, nil, false)
|
return graph.NextLogOut(it, nil, false)
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ func (it *Or) Next() bool {
|
||||||
return graph.NextLogOut(it, it.result, true)
|
return graph.NextLogOut(it, it.result, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := graph.Err(curIt); err != nil {
|
if err := curIt.Err(); err != nil {
|
||||||
it.err = err
|
it.err = err
|
||||||
return graph.NextLogOut(it, nil, false)
|
return graph.NextLogOut(it, nil, false)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ func (it *Comparison) Next() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := graph.Err(it.subIt); err != nil {
|
if err := it.subIt.Err(); err != nil {
|
||||||
it.err = err
|
it.err = err
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue