mirror of https://github.com/hak5/bolt.git
parent
1bc3b1f90e
commit
107dea6e7a
2
Makefile
2
Makefile
|
@ -9,7 +9,7 @@ race:
|
|||
|
||||
# go get github.com/kisielk/errcheck
|
||||
errcheck:
|
||||
@errcheck -ignorepkg=bytes -ignore=os:Remove github.com/boltdb/bolt
|
||||
@errcheck -ignorepkg=bytes -ignore=os:Remove github.com/hak5/bolt
|
||||
|
||||
test:
|
||||
@go test -v -cover .
|
||||
|
|
10
README.md
10
README.md
|
@ -1,4 +1,4 @@
|
|||
Bolt [![Coverage Status](https://coveralls.io/repos/boltdb/bolt/badge.svg?branch=master)](https://coveralls.io/r/boltdb/bolt?branch=master) [![GoDoc](https://godoc.org/github.com/boltdb/bolt?status.svg)](https://godoc.org/github.com/boltdb/bolt) ![Version](https://img.shields.io/badge/version-1.2.1-green.svg)
|
||||
Bolt [![Coverage Status](https://coveralls.io/repos/boltdb/bolt/badge.svg?branch=master)](https://coveralls.io/r/boltdb/bolt?branch=master) [![GoDoc](https://godoc.org/github.com/hak5/bolt?status.svg)](https://godoc.org/github.com/hak5/bolt) ![Version](https://img.shields.io/badge/version-1.2.1-green.svg)
|
||||
====
|
||||
|
||||
Bolt is a pure Go key/value store inspired by [Howard Chu's][hyc_symas]
|
||||
|
@ -78,7 +78,7 @@ Shopify and Heroku use Bolt-backed services every day.
|
|||
To start using Bolt, install Go and run `go get`:
|
||||
|
||||
```sh
|
||||
$ go get github.com/boltdb/bolt/...
|
||||
$ go get github.com/hak5/bolt/...
|
||||
```
|
||||
|
||||
This will retrieve the library and install the `bolt` command line utility into
|
||||
|
@ -98,7 +98,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/hak5/bolt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -541,7 +541,7 @@ this from a read-only transaction, it will perform a hot backup and not block
|
|||
your other database reads and writes.
|
||||
|
||||
By default, it will use a regular file handle which will utilize the operating
|
||||
system's page cache. See the [`Tx`](https://godoc.org/github.com/boltdb/bolt#Tx)
|
||||
system's page cache. See the [`Tx`](https://godoc.org/github.com/hak5/bolt#Tx)
|
||||
documentation for information about optimizing for larger-than-RAM datasets.
|
||||
|
||||
One common use case is to backup over HTTP so you can use tools like `cURL` to
|
||||
|
@ -825,7 +825,7 @@ Here are a few things to note when evaluating and using Bolt:
|
|||
|
||||
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/hak5/bolt/issues/308#issuecomment-74811638
|
||||
|
||||
|
||||
## Reading the Source
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"testing"
|
||||
"testing/quick"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/hak5/bolt"
|
||||
)
|
||||
|
||||
// Ensure that a bucket that gets a non-existent key returns nil.
|
||||
|
@ -83,7 +83,7 @@ func TestBucket_Get_IncompatibleValue(t *testing.T) {
|
|||
// Ensure that a slice returned from a bucket has a capacity equal to its length.
|
||||
// This also allows slices to be appended to since it will require a realloc by Go.
|
||||
//
|
||||
// https://github.com/boltdb/bolt/issues/544
|
||||
// https://github.com/hak5/bolt/issues/544
|
||||
func TestBucket_Get_Capacity(t *testing.T) {
|
||||
db := MustOpenDB()
|
||||
defer db.MustClose()
|
||||
|
@ -867,7 +867,7 @@ func TestBucket_NextSequence(t *testing.T) {
|
|||
|
||||
// Ensure that a bucket will persist an autoincrementing sequence even if its
|
||||
// the only thing updated on the bucket.
|
||||
// https://github.com/boltdb/bolt/issues/296
|
||||
// https://github.com/hak5/bolt/issues/296
|
||||
func TestBucket_NextSequence_Persist(t *testing.T) {
|
||||
db := MustOpenDB()
|
||||
defer db.MustClose()
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"unicode/utf8"
|
||||
"unsafe"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/hak5/bolt"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -875,7 +875,7 @@ The following errors can be reported:
|
|||
No errors should occur in your database. However, if for some reason you
|
||||
experience corruption, please submit a ticket to the Bolt project page:
|
||||
|
||||
https://github.com/boltdb/bolt/issues
|
||||
https://github.com/hak5/bolt/issues
|
||||
`, "\n")
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/boltdb/bolt/cmd/bolt"
|
||||
"github.com/hak5/bolt"
|
||||
"github.com/hak5/bolt/cmd/bolt"
|
||||
)
|
||||
|
||||
// Ensure the "info" command can print information about a database.
|
||||
|
|
|
@ -36,7 +36,7 @@ func (c *Cursor) First() (key []byte, value []byte) {
|
|||
c.first()
|
||||
|
||||
// If we land on an empty page then move to the next value.
|
||||
// https://github.com/boltdb/bolt/issues/450
|
||||
// https://github.com/hak5/bolt/issues/450
|
||||
if c.stack[len(c.stack)-1].count() == 0 {
|
||||
c.next()
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ func (c *Cursor) next() (key []byte, value []byte, flags uint32) {
|
|||
c.first()
|
||||
|
||||
// If this is an empty page then restart and move back up the stack.
|
||||
// https://github.com/boltdb/bolt/issues/450
|
||||
// https://github.com/hak5/bolt/issues/450
|
||||
if c.stack[len(c.stack)-1].count() == 0 {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"testing"
|
||||
"testing/quick"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/hak5/bolt"
|
||||
)
|
||||
|
||||
// Ensure that a cursor can return a reference to the bucket that created it.
|
||||
|
@ -165,7 +165,7 @@ func TestCursor_Delete(t *testing.T) {
|
|||
// large number of keys. This test also checks that seek will always move
|
||||
// forward to the next key.
|
||||
//
|
||||
// Related: https://github.com/boltdb/bolt/pull/187
|
||||
// Related: https://github.com/hak5/bolt/pull/187
|
||||
func TestCursor_Seek_Large(t *testing.T) {
|
||||
db := MustOpenDB()
|
||||
defer db.MustClose()
|
||||
|
|
4
db.go
4
db.go
|
@ -66,7 +66,7 @@ type DB struct {
|
|||
// Skipping truncation avoids preallocation of hard drive space and
|
||||
// bypasses a truncate() and fsync() syscall on remapping.
|
||||
//
|
||||
// https://github.com/boltdb/bolt/issues/284
|
||||
// https://github.com/hak5/bolt/issues/284
|
||||
NoGrowSync bool
|
||||
|
||||
// If you want to read the entire database fast, you can set MmapFlag to
|
||||
|
@ -871,7 +871,7 @@ func (db *DB) grow(sz int) error {
|
|||
}
|
||||
|
||||
// Truncate and fsync to ensure file size metadata is flushed.
|
||||
// https://github.com/boltdb/bolt/issues/284
|
||||
// https://github.com/hak5/bolt/issues/284
|
||||
if !db.NoGrowSync && !db.readOnly {
|
||||
if runtime.GOOS != "windows" {
|
||||
if err := db.file.Truncate(int64(sz)); err != nil {
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/hak5/bolt"
|
||||
)
|
||||
|
||||
var statsFlag = flag.Bool("stats", false, "show performance stats")
|
||||
|
@ -180,7 +180,7 @@ func TestOpen_ErrChecksum(t *testing.T) {
|
|||
}
|
||||
|
||||
// Ensure that opening a database does not increase its size.
|
||||
// https://github.com/boltdb/bolt/issues/291
|
||||
// https://github.com/hak5/bolt/issues/291
|
||||
func TestOpen_Size(t *testing.T) {
|
||||
// Open a data file.
|
||||
db := MustOpenDB()
|
||||
|
@ -240,7 +240,7 @@ func TestOpen_Size(t *testing.T) {
|
|||
}
|
||||
|
||||
// Ensure that opening a database beyond the max step size does not increase its size.
|
||||
// https://github.com/boltdb/bolt/issues/303
|
||||
// https://github.com/hak5/bolt/issues/303
|
||||
func TestOpen_Size_Large(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("short mode")
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module github.com/hak5/bolt
|
||||
|
||||
go 1.17
|
||||
|
||||
require golang.org/x/sys v0.0.0-20220209214540-3681064d5158
|
|
@ -0,0 +1,2 @@
|
|||
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c=
|
||||
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
2
node.go
2
node.go
|
@ -229,7 +229,7 @@ func (n *node) write(p *page) {
|
|||
// If the length of key+value is larger than the max allocation size
|
||||
// then we need to reallocate the byte array pointer.
|
||||
//
|
||||
// See: https://github.com/boltdb/bolt/pull/335
|
||||
// See: https://github.com/hak5/bolt/pull/335
|
||||
klen, vlen := len(item.key), len(item.value)
|
||||
if len(b) < klen+vlen {
|
||||
b = (*[maxAllocSize]byte)(unsafe.Pointer(&b[0]))[:]
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/hak5/bolt"
|
||||
)
|
||||
|
||||
func TestSimulate_1op_1p(t *testing.T) { testSimulate(t, 1, 1) }
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/hak5/bolt"
|
||||
)
|
||||
|
||||
// Ensure that committing a closed transaction returns an error.
|
||||
|
|
Loading…
Reference in New Issue