aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dedo.go18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/dedo.go b/src/dedo.go
index e711000..f3916c9 100644
--- a/src/dedo.go
+++ b/src/dedo.go
@@ -836,21 +836,11 @@ func bytesLE(num uint64) []byte {
}
func (b *bucketT) NextID() []byte {
- if b.tx.db == nil {
- panic(ErrTxClosed)
- } else if !b.tx.writable {
- panic(ErrTxNotWritable)
- }
-
- // Materialize the root node if it hasn't been already so that the
- // bucket will be saved during commit.
- if b.rootNode == nil {
- _ = b.node(b.ref.root, nil)
+ id, err := b.NextSequence()
+ if err != nil {
+ panic(err)
}
-
- // Increment and return the sequence.
- b.ref.sequence++
- return bytesLE(b.ref.sequence)
+ return bytesLE(id)
}
/// bucketT.NextSequence() returns an autoincrementing integer for the bucket.