Move irreparabledb under datarepair (#764)

This commit is contained in:
Egon Elbre 2018-12-06 14:32:21 +02:00 committed by GitHub
parent 8592e29260
commit fc8e9c6572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 20 additions and 24 deletions

View File

@ -10,8 +10,8 @@ import (
"github.com/gogo/protobuf/proto"
"go.uber.org/zap"
"storj.io/storj/pkg/datarepair/irreparabledb"
"storj.io/storj/pkg/datarepair/queue"
"storj.io/storj/pkg/irreparabledb"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/pointerdb"
"storj.io/storj/pkg/storj"

View File

@ -17,8 +17,8 @@ import (
"storj.io/storj/internal/teststorj"
"storj.io/storj/pkg/auth"
"storj.io/storj/pkg/datarepair/irreparabledb"
"storj.io/storj/pkg/datarepair/queue"
"storj.io/storj/pkg/irreparabledb"
"storj.io/storj/pkg/overlay"
"storj.io/storj/pkg/overlay/mocks"
"storj.io/storj/pkg/pb"

View File

@ -9,8 +9,8 @@ import (
"go.uber.org/zap"
"storj.io/storj/pkg/datarepair/irreparabledb"
"storj.io/storj/pkg/datarepair/queue"
"storj.io/storj/pkg/irreparabledb"
"storj.io/storj/pkg/overlay"
mock "storj.io/storj/pkg/overlay/mocks"
"storj.io/storj/pkg/pb"

View File

@ -6,11 +6,16 @@ package irreparabledb
import (
"context"
"github.com/zeebo/errs"
"storj.io/storj/internal/migrate"
dbx "storj.io/storj/pkg/irreparabledb/dbx"
dbx "storj.io/storj/pkg/datarepair/irreparabledb/dbx"
"storj.io/storj/pkg/utils"
)
// Error is the default irreparabledb errs class
var Error = errs.Class("irreparabledb error")
// Database implements the irreparable RPC service
type Database struct {
db *dbx.DB

View File

@ -1,7 +1,7 @@
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package irreparabledb
package irreparabledb_test
import (
"context"
@ -11,11 +11,13 @@ import (
"time"
"github.com/stretchr/testify/assert"
"storj.io/storj/internal/testcontext"
"storj.io/storj/pkg/datarepair/irreparabledb"
)
const (
// this connstring is expected to work under the storj-test docker-compose instance
// postgres connstring that works with docker-compose
defaultPostgresConn = "postgres://storj:storj-pass@test-postgres/teststorj?sslmode=disable"
)
@ -32,11 +34,11 @@ func TestPostgres(t *testing.T) {
defer ctx.Cleanup()
// creating in-memory db and opening connection
irrdb, err := New(*testPostgres)
irrdb, err := irreparabledb.New(*testPostgres)
if err != nil {
t.Fatal(err)
}
defer ctx.Check(irrdb.db.Close)
defer ctx.Check(irrdb.Close)
testDatabase(ctx, t, irrdb)
}
@ -46,18 +48,18 @@ func TestSqlite3(t *testing.T) {
defer ctx.Cleanup()
// creating in-memory db and opening connection
irrdb, err := New("sqlite3://file::memory:?mode=memory&cache=shared")
irrdb, err := irreparabledb.New("sqlite3://file::memory:?mode=memory&cache=shared")
if err != nil {
t.Fatal(err)
}
defer ctx.Check(irrdb.db.Close)
defer ctx.Check(irrdb.Close)
testDatabase(ctx, t, irrdb)
}
func testDatabase(ctx context.Context, t *testing.T, irrdb *Database) {
func testDatabase(ctx context.Context, t *testing.T, irrdb *irreparabledb.Database) {
//testing variables
segmentInfo := &RemoteSegmentInfo{
segmentInfo := &irreparabledb.RemoteSegmentInfo{
EncryptedSegmentPath: []byte("IamSegmentkeyinfo"),
EncryptedSegmentDetail: []byte("IamSegmentdetailinfo"),
LostPiecesCount: int64(10),

View File

@ -1,11 +0,0 @@
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package irreparabledb
import (
"github.com/zeebo/errs"
)
// Error is the default boltdb errs class
var Error = errs.Class("irreparabaledb error")