Merge pull request #85 from pbnjay/global_uids
fix non-pointer uintptr -> uint64, export NextUID
This commit is contained in:
commit
0238332ca3
2 changed files with 7 additions and 7 deletions
|
|
@ -114,7 +114,7 @@ type Iterator interface {
|
||||||
Close()
|
Close()
|
||||||
|
|
||||||
// UID returns the unique identifier of the iterator.
|
// UID returns the unique identifier of the iterator.
|
||||||
UID() uintptr
|
UID() uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// FixedIterator wraps iterators that are modifiable by addition of fixed value sets.
|
// FixedIterator wraps iterators that are modifiable by addition of fixed value sets.
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ import (
|
||||||
"github.com/google/cayley/graph"
|
"github.com/google/cayley/graph"
|
||||||
)
|
)
|
||||||
|
|
||||||
var nextIteratorID uintptr
|
var nextIteratorID uint64
|
||||||
|
|
||||||
func nextID() uintptr {
|
func NextUID() uint64 {
|
||||||
return atomic.AddUintptr(&nextIteratorID, 1) - 1
|
return atomic.AddUint64(&nextIteratorID, 1) - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Base iterator is the iterator other iterators inherit from to get some
|
// The Base iterator is the iterator other iterators inherit from to get some
|
||||||
|
|
@ -40,7 +40,7 @@ type Base struct {
|
||||||
tags []string
|
tags []string
|
||||||
fixedTags map[string]graph.Value
|
fixedTags map[string]graph.Value
|
||||||
canNext bool
|
canNext bool
|
||||||
uid uintptr
|
uid uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by subclases.
|
// Called by subclases.
|
||||||
|
|
@ -48,11 +48,11 @@ func BaseInit(it *Base) {
|
||||||
// Your basic iterator is nextable
|
// Your basic iterator is nextable
|
||||||
it.canNext = true
|
it.canNext = true
|
||||||
if glog.V(2) {
|
if glog.V(2) {
|
||||||
it.uid = nextID()
|
it.uid = NextUID()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (it *Base) UID() uintptr {
|
func (it *Base) UID() uint64 {
|
||||||
return it.uid
|
return it.uid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue