mirror of https://github.com/etcd-io/bbolt.git
parent
8961219de8
commit
9f841cc213
|
@ -5,14 +5,16 @@ import (
|
|||
crypto "crypto/rand"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"go.etcd.io/bbolt/internal/btesting"
|
||||
"io"
|
||||
"math/rand"
|
||||
"os"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"go.etcd.io/bbolt/internal/btesting"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
bolt "go.etcd.io/bbolt"
|
||||
main "go.etcd.io/bbolt/cmd/bbolt"
|
||||
)
|
||||
|
|
|
@ -136,6 +136,8 @@ func (p *Page) Overflow() uint32 {
|
|||
}
|
||||
|
||||
// DO NOT EDIT. Copied from the "bolt" package.
|
||||
|
||||
// TODO(ptabor): Make the page-types an enum.
|
||||
func (p *Page) Type() string {
|
||||
if (p.flags & branchPageFlag) != 0 {
|
||||
return "branch"
|
||||
|
|
|
@ -2,11 +2,13 @@ package surgeon_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
bolt "go.etcd.io/bbolt"
|
||||
"go.etcd.io/bbolt/internal/btesting"
|
||||
"go.etcd.io/bbolt/internal/surgeon"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRevertMetaPage(t *testing.T) {
|
||||
|
|
|
@ -69,9 +69,9 @@ func (n XRay) traverseInternal(stack []guts_cli.Pgid, callback func(page *guts_c
|
|||
return nil
|
||||
}
|
||||
|
||||
// FindPathToPagesWithKey finds a path (from root to the page that contains the given key.
|
||||
// As it traverses multiple buckets, in theory there might be multiple keys with given name.
|
||||
// Note: For simplicity it's currently implemented as traversing whole reachable tree.
|
||||
// FindPathToPagesWithKey finds all paths from root to the page that contains the given key.
|
||||
// As it traverses multiple buckets, so in theory there might be multiple keys with the given name.
|
||||
// Note: For simplicity it's currently implemented as traversing of the whole reachable tree.
|
||||
func (n XRay) FindPathToPagesWithKey(key []byte) ([][]guts_cli.Pgid, error) {
|
||||
var found [][]guts_cli.Pgid
|
||||
|
||||
|
|
|
@ -2,11 +2,13 @@ package surgeon_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"go.etcd.io/bbolt/internal/btesting"
|
||||
"go.etcd.io/bbolt/internal/guts_cli"
|
||||
"go.etcd.io/bbolt/internal/surgeon"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNavigator_FindPathToPagesWithKey(t *testing.T) {
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
#!/bin/bash
|
||||
GO_CMD="go"
|
||||
|
||||
go list --f '{{with $d:=.}}{{range .GoFiles}}{{$d.Dir}}/{{.}}{{"\n"}}{{end}}{{end}}' ./... | xargs go run golang.org/x/tools/cmd/goimports@latest -w -local go.etcd.io
|
||||
GOFILES=$(${GO_CMD} list --f "{{with \$d:=.}}{{range .GoFiles}}{{\$d.Dir}}/{{.}}{{\"\n\"}}{{end}}{{end}}" ./...)
|
||||
TESTGOFILES=$(${GO_CMD} list --f "{{with \$d:=.}}{{range .TestGoFiles}}{{\$d.Dir}}/{{.}}{{\"\n\"}}{{end}}{{end}}" ./...)
|
||||
XTESTGOFILES=$(${GO_CMD} list --f "{{with \$d:=.}}{{range .XTestGoFiles}}{{\$d.Dir}}/{{.}}{{\"\n\"}}{{end}}{{end}}" ./...)
|
||||
|
||||
|
||||
echo "${GOFILES}" "${TESTGOFILES}" "${XTESTGOFILES}"| xargs -n 100 go run golang.org/x/tools/cmd/goimports@latest -w -local go.etcd.io
|
||||
|
||||
go fmt ./...
|
||||
|
|
Loading…
Reference in New Issue