common: separate repository

Change-Id: Ibb89c42060450e3839481a7e495bbe3ad940610a
This commit is contained in:
Egon Elbre 2019-12-27 13:48:47 +02:00
parent 115b8b0fc8
commit 6615ecc9b6
641 changed files with 1532 additions and 48088 deletions

View File

@ -43,8 +43,6 @@ pipeline {
sh 'check-large-files'
sh 'check-imports -race ./...'
sh 'check-peer-constraints -race'
sh 'storj-protobuf --protoc=$HOME/protoc/bin/protoc lint'
sh 'storj-protobuf --protoc=$HOME/protoc/bin/protoc check-lock'
sh 'check-atomic-align ./...'
sh 'check-errs ./...'
sh 'bash ./scripts/check-dbx-version.sh'

View File

@ -63,12 +63,6 @@ goimports-fix: ## Applies goimports to every go file (excluding vendored files)
goimports-st: ## Applies goimports to every go file in `git status` (ignores untracked files)
@git status --porcelain -uno|grep .go|grep -v "^D"|sed -E 's,\w+\s+(.+->\s+)?,,g'|xargs -I {} goimports -w -local storj.io {}
.PHONY: proto
proto: ## Rebuild protobuf files
@echo "Running ${@}"
go run scripts/protobuf.go install
go run scripts/protobuf.go generate
.PHONY: build-packages
build-packages: build-packages-race build-packages-normal build-npm ## Test docker images locally
build-packages-race:

View File

@ -19,9 +19,9 @@ import (
"github.com/zeebo/errs"
"gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/rpc/rpcpeer"
"storj.io/common/identity"
"storj.io/common/pb"
"storj.io/common/rpc/rpcpeer"
)
const (

View File

@ -14,13 +14,13 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"storj.io/common/identity/testidentity"
"storj.io/common/pb"
"storj.io/common/peertls/tlsopts"
"storj.io/common/rpc"
"storj.io/common/storj"
"storj.io/common/testcontext"
"storj.io/storj/certificate/certificateclient"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/peertls/tlsopts"
"storj.io/storj/pkg/rpc"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testidentity"
)
var (

View File

@ -10,8 +10,8 @@ import (
"github.com/zeebo/errs"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/peertls/extensions"
"storj.io/common/identity"
"storj.io/common/peertls/extensions"
"storj.io/storj/private/dbutil"
"storj.io/storj/storage"
"storj.io/storj/storage/boltdb"

View File

@ -15,11 +15,11 @@ import (
"github.com/stretchr/testify/require"
"github.com/zeebo/errs"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/rpc/rpcpeer"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testidentity"
"storj.io/common/identity"
"storj.io/common/identity/testidentity"
"storj.io/common/pb"
"storj.io/common/rpc/rpcpeer"
"storj.io/common/testcontext"
"storj.io/storj/storage"
)

View File

@ -12,8 +12,8 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/storj/private/errs2"
"storj.io/storj/private/testcontext"
"storj.io/common/errs2"
"storj.io/common/testcontext"
)
func TestEndpoint_Run_httpSuccess(t *testing.T) {

View File

@ -10,7 +10,7 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap/zaptest"
"storj.io/storj/private/testcontext"
"storj.io/common/testcontext"
)
func TestService_GetOrCreate(t *testing.T) {

View File

@ -10,10 +10,10 @@ import (
"github.com/zeebo/errs"
"gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/peertls/tlsopts"
"storj.io/storj/pkg/rpc"
"storj.io/common/identity"
"storj.io/common/pb"
"storj.io/common/peertls/tlsopts"
"storj.io/common/rpc"
)
var mon = monkit.Package()

View File

@ -8,12 +8,12 @@ import (
"go.uber.org/zap"
"storj.io/common/errs2"
"storj.io/common/identity"
"storj.io/common/pb"
"storj.io/common/rpc/rpcpeer"
"storj.io/common/rpc/rpcstatus"
"storj.io/storj/certificate/authorization"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/rpc/rpcpeer"
"storj.io/storj/pkg/rpc/rpcstatus"
"storj.io/storj/private/errs2"
)
// Endpoint implements pb.CertificatesServer.

View File

@ -12,13 +12,13 @@ import (
"golang.org/x/sync/errgroup"
"gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/common/errs2"
"storj.io/common/identity"
"storj.io/common/pb"
"storj.io/common/peertls/tlsopts"
"storj.io/storj/certificate/authorization"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/peertls/tlsopts"
"storj.io/storj/pkg/revocation"
"storj.io/storj/pkg/server"
"storj.io/storj/private/errs2"
)
var (

View File

@ -14,19 +14,19 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/common/identity"
"storj.io/common/identity/testidentity"
"storj.io/common/pb"
"storj.io/common/peertls/tlsopts"
"storj.io/common/pkcrypto"
"storj.io/common/rpc"
"storj.io/common/rpc/rpcpeer"
"storj.io/common/storj"
"storj.io/common/testcontext"
"storj.io/storj/certificate"
"storj.io/storj/certificate/authorization"
"storj.io/storj/certificate/certificateclient"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/peertls/tlsopts"
"storj.io/storj/pkg/pkcrypto"
"storj.io/storj/pkg/rpc"
"storj.io/storj/pkg/rpc/rpcpeer"
"storj.io/storj/pkg/server"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testidentity"
)
// TODO: test sad path

View File

@ -8,12 +8,12 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/common/fpath"
"storj.io/storj/certificate"
"storj.io/storj/certificate/authorization"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/revocation"
"storj.io/storj/private/fpath"
)
var (

View File

@ -10,9 +10,9 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/certificate/authorization"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
)
var (

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/storj/pkg/identity"
"storj.io/common/identity"
)
var (

View File

@ -11,7 +11,7 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/storj/pkg/identity"
"storj.io/common/identity"
)
type verifyConfig struct {

View File

@ -18,13 +18,13 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/common/fpath"
"storj.io/common/storj"
"storj.io/storj/cmd/internal/wizard"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/miniogw"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/fpath"
"storj.io/storj/private/version"
"storj.io/storj/private/version/checker"
"storj.io/storj/uplink"

View File

@ -19,12 +19,12 @@ import (
"github.com/zeebo/errs"
"golang.org/x/sync/errgroup"
"storj.io/common/identity"
"storj.io/common/peertls"
"storj.io/common/pkcrypto"
"storj.io/common/storj"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/peertls"
"storj.io/storj/pkg/pkcrypto"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/cui"
)

View File

@ -11,9 +11,9 @@ import (
"github.com/spf13/cobra"
"storj.io/common/identity"
"storj.io/common/peertls/extensions"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/peertls/extensions"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/revocation"
)

View File

@ -9,8 +9,8 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/common/identity"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/process"
)

View File

@ -14,16 +14,16 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/common/fpath"
"storj.io/common/identity"
"storj.io/common/peertls/extensions"
"storj.io/common/peertls/tlsopts"
"storj.io/common/pkcrypto"
"storj.io/common/rpc"
"storj.io/storj/certificate/certificateclient"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/peertls/extensions"
"storj.io/storj/pkg/peertls/tlsopts"
"storj.io/storj/pkg/pkcrypto"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/revocation"
"storj.io/storj/pkg/rpc"
"storj.io/storj/private/fpath"
"storj.io/storj/private/version"
"storj.io/storj/private/version/checker"
)

View File

@ -18,11 +18,11 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/pb"
"storj.io/common/identity"
"storj.io/common/pb"
"storj.io/common/rpc"
"storj.io/common/storj"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/rpc"
"storj.io/storj/pkg/storj"
"storj.io/storj/uplink/eestream"
)

View File

@ -11,8 +11,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"storj.io/common/testcontext"
"storj.io/storj/cmd/internal/asset"
"storj.io/storj/private/testcontext"
)
func TestAssets(t *testing.T) {

View File

@ -13,12 +13,12 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/common/fpath"
"storj.io/storj/lib/uplink"
"storj.io/storj/linksharing"
"storj.io/storj/linksharing/httpserver"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
)
// LinkSharing defines link sharing configuration

View File

@ -16,7 +16,7 @@ import (
"github.com/loov/hrtime"
"storj.io/storj/private/memory"
"storj.io/common/memory"
"storj.io/storj/private/s3client"
)

View File

@ -18,10 +18,10 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/signing"
"storj.io/storj/pkg/storj"
"storj.io/common/identity"
"storj.io/common/pb"
"storj.io/common/signing"
"storj.io/common/storj"
"storj.io/storj/satellite/gracefulexit"
"storj.io/storj/satellite/satellitedb"
)

View File

@ -15,12 +15,12 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/common/fpath"
"storj.io/common/storj"
"storj.io/storj/cmd/satellite/reports"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/revocation"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/fpath"
"storj.io/storj/private/version"
"storj.io/storj/satellite"
"storj.io/storj/satellite/accounting/live"

View File

@ -16,8 +16,8 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/common/memory"
"storj.io/storj/private/dbutil"
"storj.io/storj/private/memory"
"storj.io/storj/satellite/attribution"
"storj.io/storj/satellite/satellitedb"
)

View File

@ -16,9 +16,9 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/storj/pkg/pb"
"storj.io/common/pb"
"storj.io/common/storj"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/storj"
"storj.io/storj/satellite/metainfo"
"storj.io/storj/storage"
)

View File

@ -11,8 +11,8 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/require"
"storj.io/storj/pkg/pb"
"storj.io/storj/private/testcontext"
"storj.io/common/pb"
"storj.io/common/testcontext"
"storj.io/storj/satellite/metainfo"
"storj.io/storj/storage"
"storj.io/storj/storage/teststore"

View File

@ -14,8 +14,8 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/storj"
"storj.io/common/pb"
"storj.io/common/storj"
"storj.io/storj/satellite/metainfo"
)

View File

@ -23,10 +23,10 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testrand"
"storj.io/common/pb"
"storj.io/common/storj"
"storj.io/common/testcontext"
"storj.io/common/testrand"
"storj.io/storj/satellite/metainfo"
"storj.io/storj/storage"
)

View File

@ -10,7 +10,7 @@ import (
"github.com/zeebo/admission/admproto"
"storj.io/storj/private/memory"
"storj.io/common/memory"
)
// PacketFilter inspects a packet header to determine if it should be passed

View File

@ -13,10 +13,10 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/common/fpath"
"storj.io/storj/cmd/statreceiver/luacfg"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
)
// Config is the set of configuration values we care about

View File

@ -10,7 +10,7 @@ import (
"github.com/zeebo/admission/admproto"
"storj.io/storj/private/memory"
"storj.io/common/memory"
)
// Parser is a PacketDest that sends data to a MetricDest

View File

@ -26,13 +26,13 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/common/errs2"
"storj.io/common/fpath"
"storj.io/common/identity"
"storj.io/common/storj"
"storj.io/common/sync2"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/errs2"
"storj.io/storj/private/fpath"
"storj.io/storj/private/sync2"
"storj.io/storj/private/version"
"storj.io/storj/private/version/checker"
)

View File

@ -22,11 +22,11 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testidentity"
"storj.io/storj/private/testrand"
"storj.io/common/identity"
"storj.io/common/identity/testidentity"
"storj.io/common/storj"
"storj.io/common/testcontext"
"storj.io/common/testrand"
"storj.io/storj/private/version"
"storj.io/storj/versioncontrol"
)

View File

@ -18,10 +18,10 @@ import (
"github.com/spf13/cobra"
"go.uber.org/zap"
"storj.io/storj/pkg/pb"
"storj.io/common/memory"
"storj.io/common/pb"
"storj.io/common/rpc"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/rpc"
"storj.io/storj/private/memory"
"storj.io/storj/private/version"
)

View File

@ -17,11 +17,11 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/storj/pkg/pb"
"storj.io/common/memory"
"storj.io/common/pb"
"storj.io/common/rpc"
"storj.io/common/storj"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/rpc"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/memory"
)
type gracefulExitClient struct {

View File

@ -15,12 +15,12 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/common/fpath"
"storj.io/common/memory"
"storj.io/common/storj"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/revocation"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/fpath"
"storj.io/storj/private/memory"
"storj.io/storj/private/version"
"storj.io/storj/storagenode"
"storj.io/storj/storagenode/storagenodedb"

View File

@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra"
"storj.io/storj/private/fpath"
"storj.io/common/fpath"
)
// Flags contains different flags for commands

View File

@ -24,12 +24,12 @@ import (
"github.com/zeebo/errs"
"golang.org/x/sync/errgroup"
"storj.io/common/fpath"
"storj.io/common/identity"
"storj.io/common/storj"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/dbutil"
"storj.io/storj/private/dbutil/pgutil"
"storj.io/storj/private/fpath"
"storj.io/storj/private/processgroup"
)

View File

@ -19,8 +19,8 @@ import (
"github.com/zeebo/errs"
"golang.org/x/sync/errgroup"
"storj.io/common/sync2"
"storj.io/storj/private/processgroup"
"storj.io/storj/private/sync2"
)
// Processes contains list of processes

View File

@ -8,8 +8,8 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
)
func init() {

View File

@ -4,8 +4,8 @@
package cmd
import (
"storj.io/common/fpath"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/private/fpath"
)
func getConfDir() string {

View File

@ -17,9 +17,9 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/common/fpath"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
)
var (

View File

@ -11,9 +11,9 @@ import (
"sync"
"testing"
"storj.io/storj/private/memory"
"storj.io/common/memory"
"storj.io/common/testrand"
"storj.io/storj/private/s3client"
"storj.io/storj/private/testrand"
)
var benchmarkCases = []struct {

View File

@ -10,10 +10,10 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/common/storj"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/fpath"
)
var (

View File

@ -9,11 +9,11 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/common/fpath"
"storj.io/common/memory"
"storj.io/common/storj"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/fpath"
"storj.io/storj/private/memory"
)
func init() {

View File

@ -10,8 +10,8 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
)
func init() {

View File

@ -12,9 +12,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"storj.io/storj/private/testcontext"
"storj.io/common/testcontext"
"storj.io/common/testrand"
"storj.io/storj/private/testplanet"
"storj.io/storj/private/testrand"
)
func min(x, y int) int {

View File

@ -8,8 +8,8 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
)
func init() {

View File

@ -8,9 +8,9 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/common/storj"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/fpath"
)
func init() {

View File

@ -8,10 +8,10 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/common/storj"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/fpath"
)
var (

View File

@ -15,11 +15,11 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/common/fpath"
"storj.io/common/storj"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/process"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/fpath"
"storj.io/storj/private/version"
"storj.io/storj/private/version/checker"
"storj.io/storj/uplink"

View File

@ -13,11 +13,11 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/common/fpath"
"storj.io/storj/cmd/internal/wizard"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
)
var (

View File

@ -13,11 +13,11 @@ import (
"github.com/spf13/cobra"
"github.com/zeebo/errs"
"storj.io/common/fpath"
"storj.io/common/macaroon"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/macaroon"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
"storj.io/storj/uplink"
)

View File

@ -11,9 +11,9 @@ import (
"github.com/spf13/cobra"
"go.uber.org/zap"
"storj.io/common/fpath"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/process"
"storj.io/storj/private/fpath"
"storj.io/storj/versioncontrol"
)

View File

@ -15,9 +15,9 @@ import (
"github.com/vivint/infectious"
"go.uber.org/zap"
"storj.io/storj/pkg/encryption"
"storj.io/storj/pkg/ranger"
"storj.io/storj/pkg/storj"
"storj.io/common/encryption"
"storj.io/common/ranger"
"storj.io/common/storj"
"storj.io/storj/uplink/eestream"
)

View File

@ -19,9 +19,9 @@ import (
"github.com/vivint/infectious"
"go.uber.org/zap"
"storj.io/storj/pkg/encryption"
"storj.io/storj/pkg/ranger"
"storj.io/storj/pkg/storj"
"storj.io/common/encryption"
"storj.io/common/ranger"
"storj.io/common/storj"
"storj.io/storj/uplink/eestream"
)

View File

@ -15,8 +15,8 @@ import (
"github.com/vivint/infectious"
"go.uber.org/zap"
"storj.io/storj/pkg/encryption"
"storj.io/storj/pkg/storj"
"storj.io/common/encryption"
"storj.io/common/storj"
"storj.io/storj/uplink/eestream"
)

View File

@ -10,9 +10,9 @@ import (
"github.com/spf13/pflag"
"google.golang.org/grpc"
"storj.io/common/identity"
"storj.io/common/peertls/tlsopts"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/peertls/tlsopts"
)
var (

4
go.mod
View File

@ -66,7 +66,6 @@ require (
github.com/minio/lsync v0.0.0-20180328070428-f332c3883f63 // indirect
github.com/minio/mc v0.0.0-20180926130011-a215fbb71884 // indirect
github.com/minio/minio-go v6.0.3+incompatible
github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5
github.com/minio/sio v0.0.0-20180327104954-6a41828a60f0 // indirect
github.com/nats-io/gnatsd v1.3.0 // indirect
github.com/nats-io/go-nats v1.6.0 // indirect
@ -102,11 +101,9 @@ require (
github.com/zeebo/structs v1.0.2
go.uber.org/zap v1.10.0
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7
golang.org/x/net v0.0.0-20190916140828-c8589233b77d // indirect
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3
google.golang.org/appengine v1.6.0 // indirect
google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610 // indirect
google.golang.org/grpc v1.23.1
gopkg.in/Shopify/sarama.v1 v1.18.0 // indirect
gopkg.in/cheggaaa/pb.v1 v1.0.25 // indirect
@ -114,5 +111,6 @@ require (
gopkg.in/olivere/elastic.v5 v5.0.76 // indirect
gopkg.in/spacemonkeygo/monkit.v2 v2.0.0-20190612171030-cf5a9e6f8fd2
gopkg.in/yaml.v2 v2.2.2
storj.io/common v0.0.0-20191227115835-d1bdf57f03e5
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2
)

4
go.sum
View File

@ -576,5 +576,9 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
storj.io/common v0.0.0-20191227102938-858ff11d8745 h1:IliNk+yL4wfFbHmRYaeMtjUsX2edlde/OnhBSmuMeOE=
storj.io/common v0.0.0-20191227102938-858ff11d8745/go.mod h1:TYezVM4WnpfGDjaDdSKxmn02ioNVl0NLHIOVwATAq94=
storj.io/common v0.0.0-20191227115835-d1bdf57f03e5 h1:N4XGzkUK2KWxEfNK75huq5f41xk98/2hvK7dRFFgve4=
storj.io/common v0.0.0-20191227115835-d1bdf57f03e5/go.mod h1:TYezVM4WnpfGDjaDdSKxmn02ioNVl0NLHIOVwATAq94=
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2 h1:8SgLYEhe99R8QlAD1EAOBPRyIR+cn2hqkXtWlAUPf/c=
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ=

View File

@ -6,8 +6,8 @@ package mobile
import (
"time"
"storj.io/common/macaroon"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/macaroon"
)
// Caveat TODO

View File

@ -8,8 +8,8 @@ import (
"io"
"time"
"storj.io/common/storj"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
)
const (

View File

@ -4,9 +4,9 @@
package mobile
import (
"storj.io/common/paths"
"storj.io/common/storj"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/paths"
"storj.io/storj/pkg/storj"
)
// EncryptionAccess holds data about encryption keys for a bucket.

View File

@ -7,8 +7,8 @@ import (
"fmt"
"time"
"storj.io/common/storj"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
)
// ObjectInfo object metadata

View File

@ -6,7 +6,7 @@ package mobile
import (
"context"
"storj.io/storj/private/fpath"
"storj.io/common/fpath"
)
type scope struct {

View File

@ -6,9 +6,9 @@ package mobile
import (
"fmt"
"storj.io/common/memory"
"storj.io/common/storj"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/memory"
)
// Config represents configuration options for an Uplink

View File

@ -4,7 +4,7 @@
package uplink
import (
"storj.io/storj/pkg/macaroon"
"storj.io/common/macaroon"
)
// APIKey represents an access credential to certain resources

View File

@ -10,7 +10,7 @@ import (
"github.com/zeebo/errs"
"storj.io/storj/pkg/storj"
"storj.io/common/storj"
"storj.io/storj/uplink/metainfo/kvmetainfo"
"storj.io/storj/uplink/storage/streams"
"storj.io/storj/uplink/stream"

View File

@ -14,12 +14,12 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/common/memory"
"storj.io/common/storj"
"storj.io/common/testcontext"
"storj.io/common/testrand"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/memory"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testplanet"
"storj.io/storj/private/testrand"
)
type testConfig struct {

View File

@ -8,11 +8,11 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/zeebo/errs"
"storj.io/storj/pkg/encryption"
"storj.io/storj/pkg/macaroon"
"storj.io/storj/pkg/paths"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/storj"
"storj.io/common/encryption"
"storj.io/common/macaroon"
"storj.io/common/paths"
"storj.io/common/pb"
"storj.io/common/storj"
)
const (

View File

@ -8,12 +8,12 @@ import (
"github.com/stretchr/testify/require"
"storj.io/common/memory"
"storj.io/common/storj"
"storj.io/common/testcontext"
"storj.io/common/testrand"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/memory"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testplanet"
"storj.io/storj/private/testrand"
)
func TestAllowedPathPrefixListing(t *testing.T) {

View File

@ -11,8 +11,8 @@ import (
"github.com/zeebo/errs"
"storj.io/common/storj"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
)
func ListBucketsExample(ctx context.Context,

View File

@ -12,8 +12,8 @@ import (
"github.com/zeebo/errs"
"storj.io/common/macaroon"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/macaroon"
)
func RestrictAccessExampleByAdmin(ctx context.Context,

View File

@ -10,8 +10,8 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/common/testcontext"
"storj.io/storj/lib/uplink"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testplanet"
)

View File

@ -14,9 +14,9 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/common/storj"
"storj.io/common/testcontext"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testplanet"
)

View File

@ -8,7 +8,7 @@ import (
"io"
"time"
"storj.io/storj/pkg/storj"
"storj.io/common/storj"
"storj.io/storj/uplink/metainfo/kvmetainfo"
"storj.io/storj/uplink/storage/streams"
"storj.io/storj/uplink/stream"

View File

@ -9,10 +9,10 @@ import (
"github.com/skyrings/skyring-common/tools/uuid"
"github.com/vivint/infectious"
"storj.io/storj/pkg/encryption"
"storj.io/storj/pkg/rpc"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/memory"
"storj.io/common/encryption"
"storj.io/common/memory"
"storj.io/common/rpc"
"storj.io/common/storj"
"storj.io/storj/uplink/ecclient"
"storj.io/storj/uplink/eestream"
"storj.io/storj/uplink/metainfo"

View File

@ -10,9 +10,9 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/common/storj"
"storj.io/common/testcontext"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testplanet"
)

View File

@ -8,7 +8,7 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/zeebo/errs"
"storj.io/storj/pkg/pb"
"storj.io/common/pb"
)
// Scope is a serializable type that represents all of the credentials you need

View File

@ -10,10 +10,10 @@ import (
"github.com/zeebo/errs"
"go.uber.org/zap"
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/peertls/tlsopts"
"storj.io/storj/pkg/rpc"
"storj.io/storj/private/memory"
"storj.io/common/identity"
"storj.io/common/memory"
"storj.io/common/peertls/tlsopts"
"storj.io/common/rpc"
"storj.io/storj/uplink/metainfo"
"storj.io/storj/uplink/metainfo/kvmetainfo"
)

View File

@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"storj.io/storj/private/testcontext"
"storj.io/common/testcontext"
)
// TestUplinkConfigDefaults tests that the uplink configuration gets the correct defaults applied

View File

@ -11,8 +11,8 @@ import (
"reflect"
"unsafe"
"storj.io/common/macaroon"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/macaroon"
)
//export new_scope

View File

@ -11,8 +11,8 @@ import (
"reflect"
"unsafe"
"storj.io/common/storj"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
)
// Bucket is a scoped uplink.Bucket

View File

@ -6,7 +6,7 @@ package main
// #include "uplink_definitions.h"
import "C"
import (
"storj.io/storj/pkg/storj"
"storj.io/common/storj"
)
// newBucketInfo returns a C bucket struct converted from a go bucket struct.

View File

@ -9,8 +9,8 @@ import (
"fmt"
"unsafe"
"storj.io/common/storj"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
)
//export new_encryption_access

View File

@ -13,9 +13,9 @@ import (
"time"
"unsafe"
"storj.io/common/errs2"
"storj.io/common/storj"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/errs2"
)
// Object is a scoped uplink.Object

View File

@ -8,8 +8,8 @@ import "C"
import (
"fmt"
"storj.io/common/storj"
libuplink "storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
)
// Project is a scoped uplink.Project

View File

@ -6,7 +6,7 @@ package main
import (
"context"
"storj.io/storj/private/fpath"
"storj.io/common/fpath"
)
// scope implements nesting context for foreign api.

View File

@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
"storj.io/storj/private/testcontext"
"storj.io/common/testcontext"
"storj.io/storj/private/testplanet"
)

View File

@ -11,8 +11,8 @@ import (
"time"
"storj.io/common/memory"
"storj.io/storj/lib/uplink"
"storj.io/storj/private/memory"
)
var universe = newHandles()

View File

@ -16,9 +16,9 @@ import (
"go.uber.org/zap"
"gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/common/ranger"
"storj.io/common/storj"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/ranger"
"storj.io/storj/pkg/storj"
)
var (

View File

@ -14,9 +14,9 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/common/storj"
"storj.io/common/testcontext"
"storj.io/storj/lib/uplink"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/testcontext"
"storj.io/storj/private/testplanet"
)

View File

@ -14,7 +14,7 @@ import (
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
"storj.io/storj/private/errs2"
"storj.io/common/errs2"
)
const (

View File

@ -21,8 +21,8 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
"storj.io/storj/pkg/pkcrypto"
"storj.io/storj/private/testcontext"
"storj.io/common/pkcrypto"
"storj.io/common/testcontext"
)
var (

View File

@ -14,10 +14,10 @@ import (
pb "google.golang.org/grpc/examples/helloworld/helloworld"
"google.golang.org/grpc/status"
"storj.io/common/errs2"
"storj.io/common/testcontext"
"storj.io/storj/pkg/auth"
"storj.io/storj/pkg/auth/grpcauth"
"storj.io/storj/private/errs2"
"storj.io/storj/private/testcontext"
)
func TestAPIKey(t *testing.T) {

View File

@ -1,170 +0,0 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package bloomfilter
import (
"encoding/binary"
"math"
"math/rand"
"github.com/zeebo/errs"
"storj.io/storj/pkg/storj"
"storj.io/storj/private/memory"
)
const (
version1 = 1
)
// rangeOffsets contains offsets for selecting subranges
// that minimize overlap in the first hash functions
var rangeOffsets = [...]byte{9, 13, 19, 23}
// Filter is a bloom filter implementation
type Filter struct {
seed byte
hashCount byte
table []byte
}
// newExplicit returns a new custom filter.
func newExplicit(seed, hashCount byte, sizeInBytes int) *Filter {
return &Filter{
seed: seed,
hashCount: hashCount,
table: make([]byte, sizeInBytes),
}
}
// NewOptimal returns a filter based on expected element count and false positive rate.
func NewOptimal(expectedElements int, falsePositiveRate float64) *Filter {
hashCount, sizeInBytes := getHashCountAndSize(expectedElements, falsePositiveRate)
seed := byte(rand.Intn(255))
return newExplicit(seed, byte(hashCount), sizeInBytes)
}
// NewOptimalMaxSize returns a filter based on expected element count and false positive rate, capped at a maximum size in bytes
func NewOptimalMaxSize(expectedElements int, falsePositiveRate float64, maxSize memory.Size) *Filter {
hashCount, sizeInBytes := getHashCountAndSize(expectedElements, falsePositiveRate)
seed := byte(rand.Intn(255))
if sizeInBytes > maxSize.Int() {
sizeInBytes = maxSize.Int()
}
return newExplicit(seed, byte(hashCount), sizeInBytes)
}
func getHashCountAndSize(expectedElements int, falsePositiveRate float64) (hashCount, size int) {
// calculation based on https://en.wikipedia.org/wiki/Bloom_filter#Optimal_number_of_hash_functions
bitsPerElement := -1.44 * math.Log2(falsePositiveRate)
hashCount = int(math.Ceil(bitsPerElement * math.Log(2)))
if hashCount > 32 {
// it will never be larger, but just in case to avoid overflow
hashCount = 32
}
size = int(math.Ceil(float64(expectedElements) * bitsPerElement / 8))
return hashCount, size
}
// Parameters returns filter parameters.
func (filter *Filter) Parameters() (hashCount, size int) {
return int(filter.hashCount), len(filter.table)
}
// Add adds an element to the bloom filter
func (filter *Filter) Add(pieceID storj.PieceID) {
offset, rangeOffset := initialConditions(filter.seed)
for k := byte(0); k < filter.hashCount; k++ {
hash, bit := subrange(offset, pieceID)
offset += rangeOffset
if offset >= len(storj.PieceID{}) {
offset -= len(storj.PieceID{})
}
bucket := hash % uint64(len(filter.table))
filter.table[bucket] |= 1 << (bit % 8)
}
}
// Contains return true if pieceID may be in the set
func (filter *Filter) Contains(pieceID storj.PieceID) bool {
offset, rangeOffset := initialConditions(filter.seed)
for k := byte(0); k < filter.hashCount; k++ {
hash, bit := subrange(offset, pieceID)
offset += rangeOffset
if offset >= len(storj.PieceID{}) {
offset -= len(storj.PieceID{})
}
bucket := hash % uint64(len(filter.table))
if filter.table[bucket]&(1<<(bit%8)) == 0 {
return false
}
}
return true
}
func initialConditions(seed byte) (initialOffset, rangeOffset int) {
initialOffset = int(seed % 32)
rangeOffset = int(rangeOffsets[int(seed/32)%len(rangeOffsets)])
return initialOffset, rangeOffset
}
func subrange(seed int, id storj.PieceID) (uint64, byte) {
if seed > len(id)-9 {
var unwrap [9]byte
n := copy(unwrap[:], id[seed:])
copy(unwrap[n:], id[:])
return binary.LittleEndian.Uint64(unwrap[:]), unwrap[8]
}
return binary.LittleEndian.Uint64(id[seed : seed+8]), id[seed+8]
}
// NewFromBytes decodes the filter from a sequence of bytes.
//
// Note: data will be referenced inside the table.
func NewFromBytes(data []byte) (*Filter, error) {
if len(data) < 3 {
return nil, errs.New("not enough data")
}
if data[0] != version1 {
return nil, errs.New("unsupported version %d", data[0])
}
filter := &Filter{}
filter.seed = data[1]
filter.hashCount = data[2]
filter.table = data[3:]
if filter.hashCount == 0 {
return nil, errs.New("invalid hash count %d", filter.hashCount)
}
return filter, nil
}
// Bytes encodes the filter into a sequence of bytes that can be transferred on network.
func (filter *Filter) Bytes() []byte {
bytes := make([]byte, 1+1+1+len(filter.table))
bytes[0] = version1
bytes[1] = filter.seed
bytes[2] = filter.hashCount
copy(bytes[3:], filter.table)
return bytes
}
// Size returns the size of Bytes call.
func (filter *Filter) Size() int64 {
// the first three bytes represent the version, seed, and hash count
return int64(1 + 1 + 1 + len(filter.table))
}

Some files were not shown because too many files have changed in this diff Show More