You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-4Lines changed: 19 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -421,10 +421,19 @@ Prev() Move to the previous key.
421
421
```
422
422
423
423
Each of those functions has a return signature of `(key []byte, value []byte)`.
424
-
When you have iterated to the end of the cursor then `Next()` will return a
425
-
`nil` key. You must seek to a position using `First()`, `Last()`, or `Seek()`
426
-
before calling `Next()` or `Prev()`. If you do not seek to a position then
427
-
these functions will return a `nil` key.
424
+
You must seek to a position using `First()`, `Last()`, or `Seek()` before calling
425
+
`Next()` or `Prev()`. If you do not seek to a position then these functions will
426
+
return a `nil` key.
427
+
428
+
When you have iterated to the end of the cursor, then `Next()` will return a
429
+
`nil` key and the cursor still points to the last element if present. When you
430
+
have iterated to the beginning of the cursor, then `Prev()` will return a `nil`
431
+
key and the cursor still points to the first element if present.
432
+
433
+
If you remove key/value pairs during iteration, the cursor may automatically
434
+
move to the next position if present in current node each time removing a key.
435
+
When you call `c.Next()` after removing a key, it may skip one key/value pair.
436
+
Refer to [pull/611](https://github.com/etcd-io/bbolt/pull/611) to get more detailed info.
428
437
429
438
During iteration, if the key is non-`nil` but the value is `nil`, that means
430
439
the key refers to a bucket rather than a value. Use `Bucket.Bucket()` to
@@ -850,6 +859,12 @@ Here are a few things to note when evaluating and using Bolt:
850
859
to grow. However, it's important to note that deleting large chunks of data
851
860
will not allow you to reclaim that space on disk.
852
861
862
+
* Removing key/values pairs in a bucket during iteration on the bucket using
863
+
cursor may not work properly. Each time when removing a key/value pair, the
864
+
cursor may automatically move to the next position if present. When users
865
+
call `c.Next()` after removing a key, it may skip one key/value pair.
866
+
Refer to https://github.com/etcd-io/bbolt/pull/611 for more detailed info.
867
+
853
868
For more information on page allocation, [see this comment][page-allocation].
0 commit comments