all: don't depend on gogo/proto directly
Change-Id: I8822dea0d1b7b99e0b828e0373a0308a42dde2be
This commit is contained in:
parent
0a1bbc9824
commit
11a44cdd88
@ -14,7 +14,6 @@ import (
|
||||
"text/tabwriter"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -115,11 +114,11 @@ func verifyGracefulExitReceipt(ctx context.Context, identity *identity.FullIdent
|
||||
|
||||
// try to unmarshal as an ExitCompleted first
|
||||
completed := &pb.ExitCompleted{}
|
||||
err = proto.Unmarshal(bytes, completed)
|
||||
err = pb.Unmarshal(bytes, completed)
|
||||
if err != nil {
|
||||
// if it is not a ExitCompleted, try ExitFailed
|
||||
failed := &pb.ExitFailed{}
|
||||
err = proto.Unmarshal(bytes, failed)
|
||||
err = pb.Unmarshal(bytes, failed)
|
||||
if err != nil {
|
||||
return errs.Wrap(err)
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
@ -131,7 +130,7 @@ func deleteSegment(ctx context.Context, db metainfo.PointerDB, path string, crea
|
||||
}
|
||||
|
||||
pointer := &pb.Pointer{}
|
||||
err = proto.Unmarshal(pointerBytes, pointer)
|
||||
err = pb.Unmarshal(pointerBytes, pointer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"storj.io/common/pb"
|
||||
@ -76,7 +75,7 @@ func makeSegment(ctx context.Context, db metainfo.PointerDB, path string, creati
|
||||
CreationDate: creationDate,
|
||||
}
|
||||
|
||||
pointerBytes, err = proto.Marshal(pointer)
|
||||
pointerBytes, err = pb.Marshal(pointer)
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -130,7 +129,7 @@ func (obsvr *observer) processSegment(ctx context.Context, path metainfo.ScopedP
|
||||
object.hasLastSegment = true
|
||||
|
||||
streamMeta := pb.StreamMeta{}
|
||||
err := proto.Unmarshal(pointer.Metadata, &streamMeta)
|
||||
err := pb.Unmarshal(pointer.Metadata, &streamMeta)
|
||||
if err != nil {
|
||||
return errs.New("unexpected error unmarshalling pointer metadata %s", err)
|
||||
}
|
||||
@ -308,7 +307,7 @@ func pointerCreationDate(ctx context.Context, db metainfo.PointerDB, projectID,
|
||||
}
|
||||
|
||||
pointer := &pb.Pointer{}
|
||||
err = proto.Unmarshal(pointerBytes, pointer)
|
||||
err = pb.Unmarshal(pointerBytes, pointer)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@ -610,10 +609,10 @@ func TestObserver_processSegment_single_project(t *testing.T) {
|
||||
streamMeta.NumberOfSegments = int64(ttObject.numberOfSegments)
|
||||
}
|
||||
path := storj.JoinPaths(project1, segmentIndex, ttObject.bucket, "path"+strconv.Itoa(i))
|
||||
metadata, err := proto.Marshal(streamMeta)
|
||||
metadata, err := pb.Marshal(streamMeta)
|
||||
require.NoError(t, err)
|
||||
|
||||
pointerBytes, err := proto.Marshal(&pb.Pointer{
|
||||
pointerBytes, err := pb.Marshal(&pb.Pointer{
|
||||
Metadata: metadata,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@ -804,7 +803,7 @@ func createNewObjectSegments(
|
||||
pointerNumSegments = int64(numSegments)
|
||||
}
|
||||
|
||||
metadata, err := proto.Marshal(&pb.StreamMeta{
|
||||
metadata, err := pb.Marshal(&pb.StreamMeta{
|
||||
NumberOfSegments: pointerNumSegments,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
3
go.mod
3
go.mod
@ -10,7 +10,6 @@ require (
|
||||
github.com/cheggaaa/pb/v3 v3.0.1
|
||||
github.com/fatih/color v1.7.0
|
||||
github.com/go-redis/redis v6.14.1+incompatible
|
||||
github.com/gogo/protobuf v1.2.1
|
||||
github.com/golang-migrate/migrate/v4 v4.7.0
|
||||
github.com/golang/protobuf v1.3.3
|
||||
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
||||
@ -48,6 +47,4 @@ require (
|
||||
storj.io/monkit-jaeger v0.0.0-20200403204040-f5a746eeacca
|
||||
storj.io/private v0.0.0-20200403212157-26f222c154f0
|
||||
storj.io/uplink v1.0.4-0.20200406100056-baa89e6fe434
|
||||
|
||||
// storj/gatway for storj-sim is installed via makefile `install-sim` target
|
||||
)
|
||||
|
6
go.sum
6
go.sum
@ -622,12 +622,6 @@ honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXe
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
storj.io/common v0.0.0-20200402141523-7780ee0cca0d/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
|
||||
storj.io/common v0.0.0-20200407070412-ce42115bd3d1 h1:GBUmaoHagdido+jX/VFuA/XRHqY010oRHqkldtp4GM8=
|
||||
storj.io/common v0.0.0-20200407070412-ce42115bd3d1/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
|
||||
storj.io/common v0.0.0-20200407120044-74683d1ef7f8 h1:7y74c8sEumarbni2+xrGfxIIBO+5zLjDkWqrS0QoI1s=
|
||||
storj.io/common v0.0.0-20200407120044-74683d1ef7f8/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
|
||||
storj.io/common v0.0.0-20200408121057-e9063c27cc58 h1:XK7Ienxfgkqigr7yPhM6Cs2AFtXgIXy8qYl2tdouvmg=
|
||||
storj.io/common v0.0.0-20200408121057-e9063c27cc58/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
|
||||
storj.io/common v0.0.0-20200408133928-c307b675fdaa h1:7+FXGh6z/Ic03DnYrtdOhiJmgjFs31n+7bKoYyJ1d1U=
|
||||
storj.io/common v0.0.0-20200408133928-c307b675fdaa/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
|
||||
storj.io/drpc v0.0.11 h1:6vLxfpSbwCLtqzAoXzXx/SxBqBtbzbmquXPqfcWKqfw=
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/btcsuite/btcutil/base58"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
|
||||
"storj.io/common/encryption"
|
||||
@ -136,7 +135,7 @@ func (s *EncryptionAccess) Serialize() (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
data, err := proto.Marshal(p)
|
||||
data, err := pb.Marshal(p)
|
||||
if err != nil {
|
||||
return "", errs.New("unable to marshal encryption access: %v", err)
|
||||
}
|
||||
@ -180,7 +179,7 @@ func ParseEncryptionAccess(serialized string) (*EncryptionAccess, error) {
|
||||
}
|
||||
|
||||
p := new(pb.EncryptionAccess)
|
||||
if err := proto.Unmarshal(data, p); err != nil {
|
||||
if err := pb.Unmarshal(data, p); err != nil {
|
||||
return nil, errs.New("unable to unmarshal encryption access: %v", err)
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ package uplink
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcutil/base58"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
|
||||
"storj.io/common/pb"
|
||||
@ -31,7 +30,7 @@ func ParseScope(scopeb58 string) (*Scope, error) {
|
||||
}
|
||||
|
||||
p := new(pb.Scope)
|
||||
if err := proto.Unmarshal(data, p); err != nil {
|
||||
if err := pb.Unmarshal(data, p); err != nil {
|
||||
return nil, errs.New("unable to unmarshal scope: %v", err)
|
||||
}
|
||||
|
||||
@ -72,7 +71,7 @@ func (s *Scope) Serialize() (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
data, err := proto.Marshal(&pb.Scope{
|
||||
data, err := pb.Marshal(&pb.Scope{
|
||||
SatelliteAddr: s.SatelliteAddr,
|
||||
ApiKey: s.APIKey.serializeRaw(),
|
||||
EncryptionAccess: access,
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/zeebo/errs"
|
||||
@ -924,13 +923,13 @@ func TestReverifyExpired1(t *testing.T) {
|
||||
// set pointer's expiration date to be already expired
|
||||
pointer, err := satellite.Metainfo.Service.Get(ctx, path)
|
||||
require.NoError(t, err)
|
||||
oldPointerBytes, err := proto.Marshal(pointer)
|
||||
oldPointerBytes, err := pb.Marshal(pointer)
|
||||
require.NoError(t, err)
|
||||
newPointer := &pb.Pointer{}
|
||||
err = proto.Unmarshal(oldPointerBytes, newPointer)
|
||||
err = pb.Unmarshal(oldPointerBytes, newPointer)
|
||||
require.NoError(t, err)
|
||||
newPointer.ExpirationDate = time.Now().Add(-1 * time.Hour)
|
||||
newPointerBytes, err := proto.Marshal(newPointer)
|
||||
newPointerBytes, err := pb.Marshal(newPointer)
|
||||
require.NoError(t, err)
|
||||
err = satellite.Metainfo.Database.CompareAndSwap(ctx, storage.Key(path), oldPointerBytes, newPointerBytes)
|
||||
require.NoError(t, err)
|
||||
@ -1040,13 +1039,13 @@ func TestReverifyExpired2(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// update pointer1 to be expired
|
||||
oldPointerBytes, err := proto.Marshal(pointer1)
|
||||
oldPointerBytes, err := pb.Marshal(pointer1)
|
||||
require.NoError(t, err)
|
||||
newPointer := &pb.Pointer{}
|
||||
err = proto.Unmarshal(oldPointerBytes, newPointer)
|
||||
err = pb.Unmarshal(oldPointerBytes, newPointer)
|
||||
require.NoError(t, err)
|
||||
newPointer.ExpirationDate = time.Now().Add(-1 * time.Hour)
|
||||
newPointerBytes, err := proto.Marshal(newPointer)
|
||||
newPointerBytes, err := pb.Marshal(newPointer)
|
||||
require.NoError(t, err)
|
||||
err = satellite.Metainfo.Database.CompareAndSwap(ctx, storage.Key(path1), oldPointerBytes, newPointerBytes)
|
||||
require.NoError(t, err)
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/zeebo/errs"
|
||||
@ -408,13 +407,13 @@ func TestVerifierExpired(t *testing.T) {
|
||||
// set pointer's expiration date to be already expired
|
||||
pointer, err := satellite.Metainfo.Service.Get(ctx, path)
|
||||
require.NoError(t, err)
|
||||
oldPointerBytes, err := proto.Marshal(pointer)
|
||||
oldPointerBytes, err := pb.Marshal(pointer)
|
||||
require.NoError(t, err)
|
||||
newPointer := &pb.Pointer{}
|
||||
err = proto.Unmarshal(oldPointerBytes, newPointer)
|
||||
err = pb.Unmarshal(oldPointerBytes, newPointer)
|
||||
require.NoError(t, err)
|
||||
newPointer.ExpirationDate = time.Now().Add(-1 * time.Hour)
|
||||
newPointerBytes, err := proto.Marshal(newPointer)
|
||||
newPointerBytes, err := pb.Marshal(newPointer)
|
||||
require.NoError(t, err)
|
||||
err = satellite.Metainfo.Database.CompareAndSwap(ctx, storage.Key(path), oldPointerBytes, newPointerBytes)
|
||||
require.NoError(t, err)
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -193,10 +192,10 @@ func TestDurabilityRatio(t *testing.T) {
|
||||
|
||||
// remove a piece from the pointer
|
||||
require.NotNil(t, oldPointer)
|
||||
oldPointerBytes, err := proto.Marshal(oldPointer)
|
||||
oldPointerBytes, err := pb.Marshal(oldPointer)
|
||||
require.NoError(t, err)
|
||||
newPointer := &pb.Pointer{}
|
||||
err = proto.Unmarshal(oldPointerBytes, newPointer)
|
||||
err = pb.Unmarshal(oldPointerBytes, newPointer)
|
||||
require.NoError(t, err)
|
||||
|
||||
remotePieces := newPointer.GetRemote().GetRemotePieces()
|
||||
@ -209,7 +208,7 @@ func TestDurabilityRatio(t *testing.T) {
|
||||
}
|
||||
}
|
||||
newPointer.Remote.RemotePieces = newPieces
|
||||
newPointerBytes, err := proto.Marshal(newPointer)
|
||||
newPointerBytes, err := pb.Marshal(newPointer)
|
||||
require.NoError(t, err)
|
||||
err = satellite.Metainfo.Database.CompareAndSwap(ctx, storage.Key(path), oldPointerBytes, newPointerBytes)
|
||||
require.NoError(t, err)
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
@ -1148,13 +1147,13 @@ func TestFailureNotFoundPieceHashUnverified(t *testing.T) {
|
||||
|
||||
// replace pointer with non-piece-hash-verified pointer
|
||||
require.NotNil(t, oldPointer)
|
||||
oldPointerBytes, err := proto.Marshal(oldPointer)
|
||||
oldPointerBytes, err := pb.Marshal(oldPointer)
|
||||
require.NoError(t, err)
|
||||
newPointer := &pb.Pointer{}
|
||||
err = proto.Unmarshal(oldPointerBytes, newPointer)
|
||||
err = pb.Unmarshal(oldPointerBytes, newPointer)
|
||||
require.NoError(t, err)
|
||||
newPointer.PieceHashesVerified = false
|
||||
newPointerBytes, err := proto.Marshal(newPointer)
|
||||
newPointerBytes, err := pb.Marshal(newPointer)
|
||||
require.NoError(t, err)
|
||||
err = satellite.Metainfo.Database.CompareAndSwap(ctx, storage.Key(path), oldPointerBytes, newPointerBytes)
|
||||
require.NoError(t, err)
|
||||
|
@ -6,7 +6,6 @@ package metainfo
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -354,7 +353,7 @@ func (endpoint *Endpoint) shouldCombine(segmentIndex int32, reqIndex int, reques
|
||||
objCommitReq := requests[reqIndex+1].GetObjectCommit()
|
||||
|
||||
streamMeta := pb.StreamMeta{}
|
||||
err := proto.Unmarshal(objCommitReq.EncryptedMetadata, &streamMeta)
|
||||
err := pb.Unmarshal(objCommitReq.EncryptedMetadata, &streamMeta)
|
||||
if err != nil {
|
||||
endpoint.log.Error("unable to unmarshal stream meta", zap.Error(err))
|
||||
return false
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/spacemonkeygo/monkit/v3"
|
||||
"github.com/zeebo/errs"
|
||||
"golang.org/x/time/rate"
|
||||
@ -307,7 +306,7 @@ func iterateDatabase(ctx context.Context, db PointerDB, observers []*observerCon
|
||||
rawPath := item.Key.String()
|
||||
pointer := &pb.Pointer{}
|
||||
|
||||
err := proto.Unmarshal(item.Value, pointer)
|
||||
err := pb.Unmarshal(item.Value, pointer)
|
||||
if err != nil {
|
||||
return LoopError.New("unexpected error unmarshalling pointer %s", err)
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/spacemonkeygo/monkit/v3"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
@ -1068,7 +1067,7 @@ func (endpoint *Endpoint) commitObject(ctx context.Context, req *pb.ObjectCommit
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
streamID := &pb.SatStreamID{}
|
||||
err = proto.Unmarshal(req.StreamId, streamID)
|
||||
err = pb.Unmarshal(req.StreamId, streamID)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
@ -1093,7 +1092,7 @@ func (endpoint *Endpoint) commitObject(ctx context.Context, req *pb.ObjectCommit
|
||||
}
|
||||
|
||||
streamMeta := pb.StreamMeta{}
|
||||
err = proto.Unmarshal(req.EncryptedMetadata, &streamMeta)
|
||||
err = pb.Unmarshal(req.EncryptedMetadata, &streamMeta)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.InvalidArgument, "invalid metadata structure")
|
||||
}
|
||||
@ -1184,7 +1183,7 @@ func (endpoint *Endpoint) getObject(ctx context.Context, projectID uuid.UUID, bu
|
||||
}
|
||||
|
||||
streamMeta := &pb.StreamMeta{}
|
||||
err = proto.Unmarshal(pointer.Metadata, streamMeta)
|
||||
err = pb.Unmarshal(pointer.Metadata, streamMeta)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
@ -1349,7 +1348,7 @@ func (endpoint *Endpoint) BeginDeleteObject(ctx context.Context, req *pb.ObjectB
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
|
||||
encodedStreamID, err := proto.Marshal(satStreamID)
|
||||
encodedStreamID, err := pb.Marshal(satStreamID)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
@ -1407,7 +1406,7 @@ func (endpoint *Endpoint) FinishDeleteObject(ctx context.Context, req *pb.Object
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
streamID := &pb.SatStreamID{}
|
||||
err = proto.Unmarshal(req.StreamId, streamID)
|
||||
err = pb.Unmarshal(req.StreamId, streamID)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
@ -1565,7 +1564,7 @@ func (endpoint *Endpoint) commitSegment(ctx context.Context, req *pb.SegmentComm
|
||||
RemotePieces: pieces,
|
||||
}
|
||||
|
||||
metadata, err := proto.Marshal(&pb.SegmentMeta{
|
||||
metadata, err := pb.Marshal(&pb.SegmentMeta{
|
||||
EncryptedKey: req.EncryptedKey,
|
||||
KeyNonce: req.EncryptedKeyNonce.Bytes(),
|
||||
})
|
||||
@ -1714,7 +1713,7 @@ func (endpoint *Endpoint) makeInlineSegment(ctx context.Context, req *pb.Segment
|
||||
// that will be affected is our per-project bandwidth and storage limits.
|
||||
}
|
||||
|
||||
metadata, err := proto.Marshal(&pb.SegmentMeta{
|
||||
metadata, err := pb.Marshal(&pb.SegmentMeta{
|
||||
EncryptedKey: req.EncryptedKey,
|
||||
KeyNonce: req.EncryptedKeyNonce.Bytes(),
|
||||
})
|
||||
@ -1868,7 +1867,7 @@ func (endpoint *Endpoint) ListSegments(ctx context.Context, req *pb.SegmentListR
|
||||
}
|
||||
|
||||
streamMeta := &pb.StreamMeta{}
|
||||
err = proto.Unmarshal(pointer.Metadata, streamMeta)
|
||||
err = pb.Unmarshal(pointer.Metadata, streamMeta)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
@ -2047,14 +2046,14 @@ func (endpoint *Endpoint) DownloadSegment(ctx context.Context, req *pb.SegmentDo
|
||||
var segmentMeta *pb.SegmentMeta
|
||||
if req.CursorPosition.Index == lastSegment {
|
||||
streamMeta := &pb.StreamMeta{}
|
||||
err = proto.Unmarshal(pointer.Metadata, streamMeta)
|
||||
err = pb.Unmarshal(pointer.Metadata, streamMeta)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
segmentMeta = streamMeta.LastSegmentMeta
|
||||
} else {
|
||||
segmentMeta = &pb.SegmentMeta{}
|
||||
err = proto.Unmarshal(pointer.Metadata, segmentMeta)
|
||||
err = pb.Unmarshal(pointer.Metadata, segmentMeta)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
@ -2157,7 +2156,7 @@ func (endpoint *Endpoint) getObjectNumberOfSegments(ctx context.Context, project
|
||||
}
|
||||
|
||||
meta := &pb.StreamMeta{}
|
||||
err = proto.Unmarshal(pointer.Metadata, meta)
|
||||
err = pb.Unmarshal(pointer.Metadata, meta)
|
||||
if err != nil {
|
||||
endpoint.log.Error("error unmarshaling pointer metadata", zap.Error(err))
|
||||
return 0, rpcstatus.Error(rpcstatus.Internal, "unable to unmarshal metadata")
|
||||
@ -2196,7 +2195,7 @@ func (endpoint *Endpoint) packStreamID(ctx context.Context, satStreamID *pb.SatS
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
|
||||
encodedStreamID, err := proto.Marshal(signedStreamID)
|
||||
encodedStreamID, err := pb.Marshal(signedStreamID)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
@ -2216,7 +2215,7 @@ func (endpoint *Endpoint) packSegmentID(ctx context.Context, satSegmentID *pb.Sa
|
||||
return nil, err
|
||||
}
|
||||
|
||||
encodedSegmentID, err := proto.Marshal(signedSegmentID)
|
||||
encodedSegmentID, err := pb.Marshal(signedSegmentID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -2232,7 +2231,7 @@ func (endpoint *Endpoint) unmarshalSatStreamID(ctx context.Context, streamID sto
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
satStreamID := &pb.SatStreamID{}
|
||||
err = proto.Unmarshal(streamID, satStreamID)
|
||||
err = pb.Unmarshal(streamID, satStreamID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -2253,7 +2252,7 @@ func (endpoint *Endpoint) unmarshalSatSegmentID(ctx context.Context, segmentID s
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
satSegmentID := &pb.SatSegmentID{}
|
||||
err = proto.Unmarshal(segmentID, satSegmentID)
|
||||
err = pb.Unmarshal(segmentID, satSegmentID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/zeebo/errs"
|
||||
@ -92,7 +91,7 @@ func TestInvalidAPIKey(t *testing.T) {
|
||||
signedStreamID, err := signing.SignStreamID(ctx, signer, satStreamID)
|
||||
require.NoError(t, err)
|
||||
|
||||
encodedStreamID, err := proto.Marshal(signedStreamID)
|
||||
encodedStreamID, err := pb.Marshal(signedStreamID)
|
||||
require.NoError(t, err)
|
||||
|
||||
streamID, err := storj.StreamIDFromBytes(encodedStreamID)
|
||||
@ -121,7 +120,7 @@ func TestInvalidAPIKey(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
encodedSegmentID, err := proto.Marshal(signedSegmentID)
|
||||
encodedSegmentID, err := pb.Marshal(signedSegmentID)
|
||||
require.NoError(t, err)
|
||||
|
||||
segmentID, err := storj.SegmentIDFromBytes(encodedSegmentID)
|
||||
@ -572,7 +571,7 @@ func TestBeginCommitListSegment(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
metadata, err := proto.Marshal(&pb.StreamMeta{
|
||||
metadata, err := pb.Marshal(&pb.StreamMeta{
|
||||
NumberOfSegments: 1,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@ -735,7 +734,7 @@ func TestInlineSegment(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
metadata, err := proto.Marshal(&pb.StreamMeta{
|
||||
metadata, err := pb.Marshal(&pb.StreamMeta{
|
||||
NumberOfSegments: int64(len(segments)),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@ -957,7 +956,7 @@ func TestIDs(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
encodedStreamID, err := proto.Marshal(signedStreamID)
|
||||
encodedStreamID, err := pb.Marshal(signedStreamID)
|
||||
require.NoError(t, err)
|
||||
|
||||
streamID, err := storj.StreamIDFromBytes(encodedStreamID)
|
||||
@ -975,7 +974,7 @@ func TestIDs(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
encodedSegmentID, err := proto.Marshal(signedSegmentID)
|
||||
encodedSegmentID, err := pb.Marshal(signedSegmentID)
|
||||
require.NoError(t, err)
|
||||
|
||||
segmentID, err := storj.SegmentIDFromBytes(encodedSegmentID)
|
||||
@ -996,7 +995,7 @@ func TestIDs(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
encodedSegmentID, err := proto.Marshal(signedSegmentID)
|
||||
encodedSegmentID, err := pb.Marshal(signedSegmentID)
|
||||
require.NoError(t, err)
|
||||
|
||||
segmentID, err := storj.SegmentIDFromBytes(encodedSegmentID)
|
||||
@ -1076,7 +1075,7 @@ func TestBatch(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
metadata, err := proto.Marshal(&pb.StreamMeta{
|
||||
metadata, err := pb.Marshal(&pb.StreamMeta{
|
||||
NumberOfSegments: int64(numOfSegments),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@ -1140,7 +1139,7 @@ func TestBatch(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
metadata, err := proto.Marshal(&pb.StreamMeta{
|
||||
metadata, err := pb.Marshal(&pb.StreamMeta{
|
||||
NumberOfSegments: int64(numOfSegments),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -45,7 +44,7 @@ func (s *Service) Put(ctx context.Context, path string, pointer *pb.Pointer) (er
|
||||
// Update the pointer with the creation date
|
||||
pointer.CreationDate = time.Now()
|
||||
|
||||
pointerBytes, err := proto.Marshal(pointer)
|
||||
pointerBytes, err := pb.Marshal(pointer)
|
||||
if err != nil {
|
||||
return Error.Wrap(err)
|
||||
}
|
||||
@ -62,7 +61,7 @@ func (s *Service) UnsynchronizedPut(ctx context.Context, path string, pointer *p
|
||||
// Update the pointer with the creation date
|
||||
pointer.CreationDate = time.Now()
|
||||
|
||||
pointerBytes, err := proto.Marshal(pointer)
|
||||
pointerBytes, err := pb.Marshal(pointer)
|
||||
if err != nil {
|
||||
return Error.Wrap(err)
|
||||
}
|
||||
@ -101,7 +100,7 @@ func (s *Service) UpdatePiecesCheckDuplicates(ctx context.Context, path string,
|
||||
|
||||
// unmarshal the pointer
|
||||
pointer = &pb.Pointer{}
|
||||
err = proto.Unmarshal(oldPointerBytes, pointer)
|
||||
err = pb.Unmarshal(oldPointerBytes, pointer)
|
||||
if err != nil {
|
||||
return nil, Error.Wrap(err)
|
||||
}
|
||||
@ -168,7 +167,7 @@ func (s *Service) UpdatePiecesCheckDuplicates(ctx context.Context, path string,
|
||||
pointer.RepairCount = ref.RepairCount
|
||||
|
||||
// marshal the pointer
|
||||
newPointerBytes, err := proto.Marshal(pointer)
|
||||
newPointerBytes, err := pb.Marshal(pointer)
|
||||
if err != nil {
|
||||
return nil, Error.Wrap(err)
|
||||
}
|
||||
@ -212,7 +211,7 @@ func (s *Service) GetWithBytes(ctx context.Context, path string) (pointerBytes [
|
||||
}
|
||||
|
||||
pointer = &pb.Pointer{}
|
||||
err = proto.Unmarshal(pointerBytes, pointer)
|
||||
err = pb.Unmarshal(pointerBytes, pointer)
|
||||
if err != nil {
|
||||
return nil, nil, Error.Wrap(err)
|
||||
}
|
||||
@ -277,7 +276,7 @@ func (s *Service) setMetadata(item *pb.ListResponse_Item, data []byte, metaFlags
|
||||
}
|
||||
|
||||
pr := &pb.Pointer{}
|
||||
err = proto.Unmarshal(data, pr)
|
||||
err = pb.Unmarshal(data, pr)
|
||||
if err != nil {
|
||||
return Error.Wrap(err)
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/time/rate"
|
||||
@ -224,7 +223,7 @@ func (endpoint *Endpoint) validateCommitSegment(ctx context.Context, req *pb.Seg
|
||||
return Error.New("missing create request or request expired")
|
||||
case !createRequest.Expiration.Equal(req.Pointer.ExpirationDate):
|
||||
return Error.New("pointer expiration date does not match requested one")
|
||||
case !proto.Equal(createRequest.Redundancy, req.Pointer.Remote.Redundancy):
|
||||
case !pb.Equal(createRequest.Redundancy, req.Pointer.Remote.Redundancy):
|
||||
return Error.New("pointer redundancy scheme date does not match requested one")
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ package metrics
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/rpc/rpcstatus"
|
||||
"storj.io/storj/satellite/metainfo"
|
||||
@ -30,7 +28,7 @@ func NewCounter() *Counter {
|
||||
// Object increments counts for inline objects and remote dependent objects.
|
||||
func (counter *Counter) Object(ctx context.Context, path metainfo.ScopedPath, pointer *pb.Pointer) (err error) {
|
||||
streamMeta := &pb.StreamMeta{}
|
||||
err = proto.Unmarshal(pointer.Metadata, streamMeta)
|
||||
err = pb.Unmarshal(pointer.Metadata, streamMeta)
|
||||
if err != nil {
|
||||
return rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
|
@ -7,8 +7,6 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"storj.io/common/pb"
|
||||
"storj.io/storj/satellite/satellitedb/dbx"
|
||||
)
|
||||
@ -21,7 +19,7 @@ type irreparableDB struct {
|
||||
func (db *irreparableDB) IncrementRepairAttempts(ctx context.Context, segmentInfo *pb.IrreparableSegment) (err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
err = db.db.WithTx(ctx, func(ctx context.Context, tx *dbx.Tx) (err error) {
|
||||
bytes, err := proto.Marshal(segmentInfo.SegmentDetail)
|
||||
bytes, err := pb.Marshal(segmentInfo.SegmentDetail)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -67,7 +65,7 @@ func (db *irreparableDB) Get(ctx context.Context, segmentPath []byte) (resp *pb.
|
||||
|
||||
p := &pb.Pointer{}
|
||||
|
||||
err = proto.Unmarshal(dbxInfo.Segmentdetail, p)
|
||||
err = pb.Unmarshal(dbxInfo.Segmentdetail, p)
|
||||
if err != nil {
|
||||
return nil, Error.Wrap(err)
|
||||
}
|
||||
@ -98,7 +96,7 @@ func (db *irreparableDB) GetLimited(ctx context.Context, limit int, lastSeenSegm
|
||||
|
||||
for _, row := range rows {
|
||||
p := &pb.Pointer{}
|
||||
err = proto.Unmarshal(row.Segmentdetail, p)
|
||||
err = pb.Unmarshal(row.Segmentdetail, p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -134,7 +133,7 @@ func (worker *Worker) Run(ctx context.Context, done func()) (err error) {
|
||||
zap.Stringer("Satellite ID", worker.satelliteID),
|
||||
zap.Stringer("reason", msg.ExitFailed.Reason))
|
||||
|
||||
exitFailedBytes, err := proto.Marshal(msg.ExitFailed)
|
||||
exitFailedBytes, err := pb.Marshal(msg.ExitFailed)
|
||||
if err != nil {
|
||||
worker.log.Error("failed to marshal exit failed message.")
|
||||
}
|
||||
@ -144,7 +143,7 @@ func (worker *Worker) Run(ctx context.Context, done func()) (err error) {
|
||||
case *pb.SatelliteMessage_ExitCompleted:
|
||||
worker.log.Info("graceful exit completed.", zap.Stringer("Satellite ID", worker.satelliteID))
|
||||
|
||||
exitCompletedBytes, err := proto.Marshal(msg.ExitCompleted)
|
||||
exitCompletedBytes, err := pb.Marshal(msg.ExitCompleted)
|
||||
if err != nil {
|
||||
worker.log.Error("failed to marshal exit completed message.")
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"hash"
|
||||
"io"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -153,7 +152,7 @@ func (w *Writer) Commit(ctx context.Context, pieceHeader *pb.PieceHeader) (err e
|
||||
return nil
|
||||
}
|
||||
pieceHeader.FormatVersion = pb.PieceHeader_FormatVersion(formatVer)
|
||||
headerBytes, err := proto.Marshal(pieceHeader)
|
||||
headerBytes, err := pb.Marshal(pieceHeader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -283,7 +282,7 @@ func (r *Reader) GetPieceHeader() (*pb.PieceHeader, error) {
|
||||
|
||||
// Deserialize and return.
|
||||
header := &pb.PieceHeader{}
|
||||
if err := proto.Unmarshal(pieceHeaderBytes, header); err != nil {
|
||||
if err := pb.Unmarshal(pieceHeaderBytes, header); err != nil {
|
||||
return nil, Error.New("piece header: %w", err)
|
||||
}
|
||||
return header, nil
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
|
||||
"storj.io/common/pb"
|
||||
@ -31,12 +30,12 @@ type ordersDB struct {
|
||||
func (db *ordersDB) Enqueue(ctx context.Context, info *orders.Info) (err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
limitSerialized, err := proto.Marshal(info.Limit)
|
||||
limitSerialized, err := pb.Marshal(info.Limit)
|
||||
if err != nil {
|
||||
return ErrOrders.Wrap(err)
|
||||
}
|
||||
|
||||
orderSerialized, err := proto.Marshal(info.Order)
|
||||
orderSerialized, err := pb.Marshal(info.Order)
|
||||
if err != nil {
|
||||
return ErrOrders.Wrap(err)
|
||||
}
|
||||
@ -93,13 +92,13 @@ func (db *ordersDB) ListUnsent(ctx context.Context, limit int) (_ []*orders.Info
|
||||
info.Limit = &pb.OrderLimit{}
|
||||
info.Order = &pb.Order{}
|
||||
|
||||
err = proto.Unmarshal(limitSerialized, info.Limit)
|
||||
err = pb.Unmarshal(limitSerialized, info.Limit)
|
||||
if err != nil {
|
||||
unmarshalErrors.Add(ErrOrders.Wrap(err))
|
||||
continue
|
||||
}
|
||||
|
||||
err = proto.Unmarshal(orderSerialized, info.Order)
|
||||
err = pb.Unmarshal(orderSerialized, info.Order)
|
||||
if err != nil {
|
||||
unmarshalErrors.Add(ErrOrders.Wrap(err))
|
||||
continue
|
||||
@ -152,13 +151,13 @@ func (db *ordersDB) ListUnsentBySatellite(ctx context.Context) (_ map[storj.Node
|
||||
info.Limit = &pb.OrderLimit{}
|
||||
info.Order = &pb.Order{}
|
||||
|
||||
err = proto.Unmarshal(limitSerialized, info.Limit)
|
||||
err = pb.Unmarshal(limitSerialized, info.Limit)
|
||||
if err != nil {
|
||||
unmarshalErrors.Add(ErrOrders.Wrap(err))
|
||||
continue
|
||||
}
|
||||
|
||||
err = proto.Unmarshal(orderSerialized, info.Order)
|
||||
err = pb.Unmarshal(orderSerialized, info.Order)
|
||||
if err != nil {
|
||||
unmarshalErrors.Add(ErrOrders.Wrap(err))
|
||||
continue
|
||||
@ -289,12 +288,12 @@ func (db *ordersDB) ListArchived(ctx context.Context, limit int) (_ []*orders.Ar
|
||||
info.Status = orders.Status(status)
|
||||
info.ArchivedAt = archivedAt
|
||||
|
||||
err = proto.Unmarshal(limitSerialized, info.Limit)
|
||||
err = pb.Unmarshal(limitSerialized, info.Limit)
|
||||
if err != nil {
|
||||
return nil, ErrOrders.Wrap(err)
|
||||
}
|
||||
|
||||
err = proto.Unmarshal(orderSerialized, info.Order)
|
||||
err = pb.Unmarshal(orderSerialized, info.Order)
|
||||
if err != nil {
|
||||
return nil, ErrOrders.Wrap(err)
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/zeebo/errs"
|
||||
|
||||
"storj.io/common/pb"
|
||||
@ -32,12 +31,12 @@ type v0PieceInfoDB struct {
|
||||
func (db *v0PieceInfoDB) Add(ctx context.Context, info *pieces.Info) (err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
orderLimit, err := proto.Marshal(info.OrderLimit)
|
||||
orderLimit, err := pb.Marshal(info.OrderLimit)
|
||||
if err != nil {
|
||||
return ErrPieceInfo.Wrap(err)
|
||||
}
|
||||
|
||||
uplinkPieceHash, err := proto.Marshal(info.UplinkPieceHash)
|
||||
uplinkPieceHash, err := pb.Marshal(info.UplinkPieceHash)
|
||||
if err != nil {
|
||||
return ErrPieceInfo.Wrap(err)
|
||||
}
|
||||
@ -137,13 +136,13 @@ func (db *v0PieceInfoDB) Get(ctx context.Context, satelliteID storj.NodeID, piec
|
||||
}
|
||||
|
||||
info.OrderLimit = &pb.OrderLimit{}
|
||||
err = proto.Unmarshal(orderLimit, info.OrderLimit)
|
||||
err = pb.Unmarshal(orderLimit, info.OrderLimit)
|
||||
if err != nil {
|
||||
return nil, ErrPieceInfo.Wrap(err)
|
||||
}
|
||||
|
||||
info.UplinkPieceHash = &pb.PieceHash{}
|
||||
err = proto.Unmarshal(uplinkPieceHash, info.UplinkPieceHash)
|
||||
err = pb.Unmarshal(uplinkPieceHash, info.UplinkPieceHash)
|
||||
if err != nil {
|
||||
return nil, ErrPieceInfo.Wrap(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user