mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
update to latest bbolt
with two changes, both not resulting in different behaviour for us.
This commit is contained in:
parent
587beb75b1
commit
db3e44913c
9 changed files with 41 additions and 33 deletions
2
go.mod
2
go.mod
|
@ -13,7 +13,7 @@ require (
|
||||||
github.com/mjl-/sherpats v0.0.6
|
github.com/mjl-/sherpats v0.0.6
|
||||||
github.com/prometheus/client_golang v1.18.0
|
github.com/prometheus/client_golang v1.18.0
|
||||||
github.com/russross/blackfriday/v2 v2.1.0
|
github.com/russross/blackfriday/v2 v2.1.0
|
||||||
go.etcd.io/bbolt v1.3.9
|
go.etcd.io/bbolt v1.3.10
|
||||||
golang.org/x/crypto v0.22.0
|
golang.org/x/crypto v0.22.0
|
||||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
||||||
golang.org/x/net v0.24.0
|
golang.org/x/net v0.24.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -68,8 +68,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
go.etcd.io/bbolt v1.3.9 h1:8x7aARPEXiXbHmtUwAIv7eV2fQFHrLLavdiJ3uzJXoI=
|
go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0=
|
||||||
go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE=
|
go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
|
1
vendor/go.etcd.io/bbolt/.go-version
generated
vendored
Normal file
1
vendor/go.etcd.io/bbolt/.go-version
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1.21.9
|
23
vendor/go.etcd.io/bbolt/README.md
generated
vendored
23
vendor/go.etcd.io/bbolt/README.md
generated
vendored
|
@ -421,10 +421,19 @@ Prev() Move to the previous key.
|
||||||
```
|
```
|
||||||
|
|
||||||
Each of those functions has a return signature of `(key []byte, value []byte)`.
|
Each of those functions has a return signature of `(key []byte, value []byte)`.
|
||||||
When you have iterated to the end of the cursor then `Next()` will return a
|
You must seek to a position using `First()`, `Last()`, or `Seek()` before calling
|
||||||
`nil` key. You must seek to a position using `First()`, `Last()`, or `Seek()`
|
`Next()` or `Prev()`. If you do not seek to a position then these functions will
|
||||||
before calling `Next()` or `Prev()`. If you do not seek to a position then
|
return a `nil` key.
|
||||||
these functions will return a `nil` key.
|
|
||||||
|
When you have iterated to the end of the cursor, then `Next()` will return a
|
||||||
|
`nil` key and the cursor still points to the last element if present. When you
|
||||||
|
have iterated to the beginning of the cursor, then `Prev()` will return a `nil`
|
||||||
|
key and the cursor still points to the first element if present.
|
||||||
|
|
||||||
|
If you remove key/value pairs during iteration, the cursor may automatically
|
||||||
|
move to the next position if present in current node each time removing a key.
|
||||||
|
When you call `c.Next()` after removing a key, it may skip one key/value pair.
|
||||||
|
Refer to [pull/611](https://github.com/etcd-io/bbolt/pull/611) to get more detailed info.
|
||||||
|
|
||||||
During iteration, if the key is non-`nil` but the value is `nil`, that means
|
During iteration, if the key is non-`nil` but the value is `nil`, that means
|
||||||
the key refers to a bucket rather than a value. Use `Bucket.Bucket()` to
|
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:
|
||||||
to grow. However, it's important to note that deleting large chunks of data
|
to grow. However, it's important to note that deleting large chunks of data
|
||||||
will not allow you to reclaim that space on disk.
|
will not allow you to reclaim that space on disk.
|
||||||
|
|
||||||
|
* Removing key/values pairs in a bucket during iteration on the bucket using
|
||||||
|
cursor may not work properly. Each time when removing a key/value pair, the
|
||||||
|
cursor may automatically move to the next position if present. When users
|
||||||
|
call `c.Next()` after removing a key, it may skip one key/value pair.
|
||||||
|
Refer to https://github.com/etcd-io/bbolt/pull/611 for more detailed info.
|
||||||
|
|
||||||
For more information on page allocation, [see this comment][page-allocation].
|
For more information on page allocation, [see this comment][page-allocation].
|
||||||
|
|
||||||
[page-allocation]: https://github.com/boltdb/bolt/issues/308#issuecomment-74811638
|
[page-allocation]: https://github.com/boltdb/bolt/issues/308#issuecomment-74811638
|
||||||
|
|
11
vendor/go.etcd.io/bbolt/cursor.go
generated
vendored
11
vendor/go.etcd.io/bbolt/cursor.go
generated
vendored
|
@ -71,7 +71,7 @@ func (c *Cursor) Last() (key []byte, value []byte) {
|
||||||
|
|
||||||
// If this is an empty page (calling Delete may result in empty pages)
|
// If this is an empty page (calling Delete may result in empty pages)
|
||||||
// we call prev to find the last page that is not empty
|
// we call prev to find the last page that is not empty
|
||||||
for len(c.stack) > 0 && c.stack[len(c.stack)-1].count() == 0 {
|
for len(c.stack) > 1 && c.stack[len(c.stack)-1].count() == 0 {
|
||||||
c.prev()
|
c.prev()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,6 +254,15 @@ func (c *Cursor) prev() (key []byte, value []byte, flags uint32) {
|
||||||
elem.index--
|
elem.index--
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
// If we've hit the beginning, we should stop moving the cursor,
|
||||||
|
// and stay at the first element, so that users can continue to
|
||||||
|
// iterate over the elements in reverse direction by calling `Next`.
|
||||||
|
// We should return nil in such case.
|
||||||
|
// Refer to https://github.com/etcd-io/bbolt/issues/733
|
||||||
|
if len(c.stack) == 1 {
|
||||||
|
c.first()
|
||||||
|
return nil, nil, 0
|
||||||
|
}
|
||||||
c.stack = c.stack[:i]
|
c.stack = c.stack[:i]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
vendor/go.etcd.io/bbolt/freelist.go
generated
vendored
11
vendor/go.etcd.io/bbolt/freelist.go
generated
vendored
|
@ -282,9 +282,8 @@ func (f *freelist) read(p *page) {
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
f.ids = nil
|
f.ids = nil
|
||||||
} else {
|
} else {
|
||||||
var ids []pgid
|
data := unsafeIndex(unsafe.Pointer(p), unsafe.Sizeof(*p), unsafe.Sizeof(pgid(0)), idx)
|
||||||
data := unsafeIndex(unsafe.Pointer(p), unsafe.Sizeof(*p), unsafe.Sizeof(ids[0]), idx)
|
ids := unsafe.Slice((*pgid)(data), count)
|
||||||
unsafeSlice(unsafe.Pointer(&ids), data, count)
|
|
||||||
|
|
||||||
// copy the ids, so we don't modify on the freelist page directly
|
// copy the ids, so we don't modify on the freelist page directly
|
||||||
idsCopy := make([]pgid, count)
|
idsCopy := make([]pgid, count)
|
||||||
|
@ -322,15 +321,13 @@ func (f *freelist) write(p *page) error {
|
||||||
p.count = uint16(l)
|
p.count = uint16(l)
|
||||||
} else if l < 0xFFFF {
|
} else if l < 0xFFFF {
|
||||||
p.count = uint16(l)
|
p.count = uint16(l)
|
||||||
var ids []pgid
|
|
||||||
data := unsafeAdd(unsafe.Pointer(p), unsafe.Sizeof(*p))
|
data := unsafeAdd(unsafe.Pointer(p), unsafe.Sizeof(*p))
|
||||||
unsafeSlice(unsafe.Pointer(&ids), data, l)
|
ids := unsafe.Slice((*pgid)(data), l)
|
||||||
f.copyall(ids)
|
f.copyall(ids)
|
||||||
} else {
|
} else {
|
||||||
p.count = 0xFFFF
|
p.count = 0xFFFF
|
||||||
var ids []pgid
|
|
||||||
data := unsafeAdd(unsafe.Pointer(p), unsafe.Sizeof(*p))
|
data := unsafeAdd(unsafe.Pointer(p), unsafe.Sizeof(*p))
|
||||||
unsafeSlice(unsafe.Pointer(&ids), data, l+1)
|
ids := unsafe.Slice((*pgid)(data), l+1)
|
||||||
ids[0] = pgid(l)
|
ids[0] = pgid(l)
|
||||||
f.copyall(ids[1:])
|
f.copyall(ids[1:])
|
||||||
}
|
}
|
||||||
|
|
6
vendor/go.etcd.io/bbolt/page.go
generated
vendored
6
vendor/go.etcd.io/bbolt/page.go
generated
vendored
|
@ -74,9 +74,8 @@ func (p *page) leafPageElements() []leafPageElement {
|
||||||
if p.count == 0 {
|
if p.count == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var elems []leafPageElement
|
|
||||||
data := unsafeAdd(unsafe.Pointer(p), unsafe.Sizeof(*p))
|
data := unsafeAdd(unsafe.Pointer(p), unsafe.Sizeof(*p))
|
||||||
unsafeSlice(unsafe.Pointer(&elems), data, int(p.count))
|
elems := unsafe.Slice((*leafPageElement)(data), int(p.count))
|
||||||
return elems
|
return elems
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,9 +90,8 @@ func (p *page) branchPageElements() []branchPageElement {
|
||||||
if p.count == 0 {
|
if p.count == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var elems []branchPageElement
|
|
||||||
data := unsafeAdd(unsafe.Pointer(p), unsafe.Sizeof(*p))
|
data := unsafeAdd(unsafe.Pointer(p), unsafe.Sizeof(*p))
|
||||||
unsafeSlice(unsafe.Pointer(&elems), data, int(p.count))
|
elems := unsafe.Slice((*branchPageElement)(data), int(p.count))
|
||||||
return elems
|
return elems
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
vendor/go.etcd.io/bbolt/unsafe.go
generated
vendored
12
vendor/go.etcd.io/bbolt/unsafe.go
generated
vendored
|
@ -1,7 +1,6 @@
|
||||||
package bbolt
|
package bbolt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,14 +25,3 @@ func unsafeByteSlice(base unsafe.Pointer, offset uintptr, i, j int) []byte {
|
||||||
// all), so this is believed to be correct.
|
// all), so this is believed to be correct.
|
||||||
return (*[maxAllocSize]byte)(unsafeAdd(base, offset))[i:j:j]
|
return (*[maxAllocSize]byte)(unsafeAdd(base, offset))[i:j:j]
|
||||||
}
|
}
|
||||||
|
|
||||||
// unsafeSlice modifies the data, len, and cap of a slice variable pointed to by
|
|
||||||
// the slice parameter. This helper should be used over other direct
|
|
||||||
// manipulation of reflect.SliceHeader to prevent misuse, namely, converting
|
|
||||||
// from reflect.SliceHeader to a Go slice type.
|
|
||||||
func unsafeSlice(slice, data unsafe.Pointer, len int) {
|
|
||||||
s := (*reflect.SliceHeader)(slice)
|
|
||||||
s.Data = uintptr(data)
|
|
||||||
s.Cap = len
|
|
||||||
s.Len = len
|
|
||||||
}
|
|
||||||
|
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
|
@ -61,8 +61,8 @@ github.com/prometheus/procfs/internal/util
|
||||||
# github.com/russross/blackfriday/v2 v2.1.0
|
# github.com/russross/blackfriday/v2 v2.1.0
|
||||||
## explicit
|
## explicit
|
||||||
github.com/russross/blackfriday/v2
|
github.com/russross/blackfriday/v2
|
||||||
# go.etcd.io/bbolt v1.3.9
|
# go.etcd.io/bbolt v1.3.10
|
||||||
## explicit; go 1.17
|
## explicit; go 1.21
|
||||||
go.etcd.io/bbolt
|
go.etcd.io/bbolt
|
||||||
# golang.org/x/crypto v0.22.0
|
# golang.org/x/crypto v0.22.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
|
|
Loading…
Reference in a new issue