mirror of
https://github.com/luxfi/zapdb.git
synced 2026-07-27 06:54:45 +00:00
fix order of imports (#1869)
This commit is contained in:
@@ -23,11 +23,12 @@ import (
|
||||
"encoding/binary"
|
||||
"io"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// flushThreshold determines when a buffer will be flushed. When performing a
|
||||
|
||||
+2
-1
@@ -28,8 +28,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
)
|
||||
|
||||
func TestBackupRestore1(t *testing.T) {
|
||||
|
||||
@@ -21,8 +21,9 @@ import (
|
||||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
)
|
||||
|
||||
var bo = struct {
|
||||
|
||||
+2
-1
@@ -30,11 +30,12 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var testCmd = &cobra.Command{
|
||||
|
||||
@@ -20,10 +20,11 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
)
|
||||
|
||||
var flattenCmd = &cobra.Command{
|
||||
|
||||
+2
-2
@@ -27,14 +27,14 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type flagOptions struct {
|
||||
|
||||
@@ -22,8 +22,9 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
)
|
||||
|
||||
var restoreFile string
|
||||
|
||||
@@ -21,9 +21,9 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
)
|
||||
|
||||
var oldKeyPath string
|
||||
|
||||
@@ -22,9 +22,10 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestRotate(t *testing.T) {
|
||||
|
||||
@@ -22,11 +22,12 @@ import (
|
||||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var streamCmd = &cobra.Command{
|
||||
|
||||
+3
-2
@@ -22,10 +22,11 @@ import (
|
||||
_ "net/http/pprof"
|
||||
"runtime"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/badger/cmd"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/dustin/go-humanize"
|
||||
"go.opencensus.io/zpages"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/badger/cmd"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -20,10 +20,11 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// WriteBatch holds the necessary info to perform batched writes.
|
||||
|
||||
+2
-2
@@ -22,9 +22,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
)
|
||||
|
||||
func TestWriteBatch(t *testing.T) {
|
||||
|
||||
@@ -31,6 +31,9 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/skl"
|
||||
@@ -38,8 +41,6 @@ import (
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
+2
-2
@@ -34,13 +34,13 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestTruncateVlogWithClose(t *testing.T) {
|
||||
|
||||
+2
-1
@@ -25,8 +25,9 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
)
|
||||
|
||||
// directoryLockGuard holds a lock on a directory and a pid file inside. The pid file isn't part
|
||||
|
||||
+1
-2
@@ -27,9 +27,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
)
|
||||
|
||||
type prefetchStatus uint8
|
||||
|
||||
+2
-1
@@ -27,10 +27,11 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type tableMock struct {
|
||||
|
||||
@@ -30,13 +30,13 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
otrace "go.opencensus.io/trace"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type levelsController struct {
|
||||
|
||||
+2
-1
@@ -25,11 +25,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// createAndOpen creates a table with the given data and adds it to the given level.
|
||||
|
||||
+2
-1
@@ -11,9 +11,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func val(large bool) []byte {
|
||||
|
||||
+3
-2
@@ -28,11 +28,12 @@ import (
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Manifest represents the contents of the MANIFEST file in a Badger store.
|
||||
|
||||
+1
-1
@@ -28,13 +28,13 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
otrace "go.opencensus.io/trace"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestManifestBasic(t *testing.T) {
|
||||
|
||||
+2
-1
@@ -34,11 +34,12 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/skl"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// memTable structure stores a skiplist and a corresponding WAL. Writes to memTable are written
|
||||
|
||||
@@ -20,9 +20,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// MergeOperator represents a Badger merge operator.
|
||||
|
||||
+1
-1
@@ -24,12 +24,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
)
|
||||
|
||||
// Note: If you add a new option X make sure you also add a WithX method on Options.
|
||||
|
||||
+1
-1
@@ -18,12 +18,12 @@ package badger
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
|
||||
@@ -24,10 +24,11 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
)
|
||||
|
||||
const batchSize = 16 << 20 // 16 MB
|
||||
|
||||
+3
-2
@@ -25,12 +25,13 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
bpb "github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func keyWithPrefix(prefix string, k int) []byte {
|
||||
|
||||
+3
-2
@@ -21,12 +21,13 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// StreamWriter is used to write data coming from multiple streams. The streams must not have any
|
||||
|
||||
+1
-1
@@ -24,12 +24,12 @@ import (
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/fb"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/golang/snappy"
|
||||
fbs "github.com/google/flatbuffers/go"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/fb"
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
|
||||
@@ -20,8 +20,9 @@ import (
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
)
|
||||
|
||||
type SimpleIterator struct {
|
||||
|
||||
+2
-1
@@ -30,10 +30,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cespare/xxhash"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/options"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func key(prefix string, i int) string {
|
||||
|
||||
+2
-1
@@ -21,9 +21,10 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type node struct {
|
||||
|
||||
+2
-1
@@ -20,8 +20,9 @@ import (
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
)
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
|
||||
@@ -26,9 +26,10 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type oracle struct {
|
||||
|
||||
+2
-2
@@ -26,10 +26,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestTxnSimple(t *testing.T) {
|
||||
|
||||
@@ -23,9 +23,10 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/table"
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (s *levelsController) validate() error {
|
||||
|
||||
@@ -32,10 +32,11 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/pkg/errors"
|
||||
otrace "go.opencensus.io/trace"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
)
|
||||
|
||||
// maxVlogFileSize is the maximum size of the vlog file which can be created. Vlog Offset is of
|
||||
|
||||
+2
-1
@@ -28,9 +28,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/y"
|
||||
)
|
||||
|
||||
func TestDynamicValueThreshold(t *testing.T) {
|
||||
|
||||
+2
-2
@@ -19,10 +19,10 @@ package y
|
||||
import (
|
||||
"hash/crc32"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
|
||||
"github.com/cespare/xxhash"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
)
|
||||
|
||||
// ErrChecksumMismatch is returned at checksum mismatch.
|
||||
|
||||
@@ -30,9 +30,10 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
+2
-1
@@ -9,9 +9,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dgraph-io/badger/v3/pb"
|
||||
"github.com/dgraph-io/ristretto/z"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func BenchmarkBuffer(b *testing.B) {
|
||||
|
||||
Reference in New Issue
Block a user