Change protobuf expirations to use time.Time (#2509)

* Change protobuf expirations to use time.Time instead of timestamp.Timestamp
This commit is contained in:
Alexander Leitner 2019-07-09 17:54:00 -04:00 committed by GitHub
parent bbc25a2bf7
commit 1c5db71faf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 359 additions and 478 deletions

View File

@ -11,7 +11,6 @@ import (
"sync"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/zeebo/errs"
"storj.io/storj/pkg/eestream"
@ -124,19 +123,12 @@ func (cursor *Cursor) getRandomValidPointer(ctx context.Context, pointerItems []
}
//delete expired items rather than auditing them
if expiration := pointer.GetExpirationDate(); expiration != nil {
t, err := ptypes.Timestamp(expiration)
if !pointer.ExpirationDate.IsZero() && pointer.ExpirationDate.Before(time.Now()) {
err := cursor.metainfo.Delete(ctx, path)
if err != nil {
errGroup.Add(err)
continue
}
if t.Before(time.Now()) {
err := cursor.metainfo.Delete(ctx, path)
if err != nil {
errGroup.Add(err)
}
continue
}
continue
}
if pointer.GetType() != pb.Pointer_REMOTE || pointer.GetSegmentSize() == 0 {

View File

@ -10,7 +10,6 @@ import (
"testing"
"time"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/require"
"storj.io/storj/internal/testcontext"
@ -37,7 +36,7 @@ func TestAuditSegment(t *testing.T) {
// change limit in library to 5 in
// list api call, default is 0 == 1000 listing
//populate metainfo with 10 non-expired pointers of test data
tests, cursor, metainfo := populateTestData(t, planet, &timestamp.Timestamp{Seconds: time.Now().Unix() + 3000})
tests, cursor, metainfo := populateTestData(t, planet, time.Now().Add(3*time.Second))
t.Run("NextStripe", func(t *testing.T) {
for _, tt := range tests {
@ -113,7 +112,7 @@ func TestDeleteExpired(t *testing.T) {
SatelliteCount: 1, StorageNodeCount: 4, UplinkCount: 1,
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
//populate metainfo with 10 expired pointers of test data
_, cursor, metainfo := populateTestData(t, planet, &timestamp.Timestamp{})
_, cursor, metainfo := populateTestData(t, planet, time.Now().Add(-time.Second*1))
//make sure it they're in there
list, _, err := metainfo.List(ctx, "", "", "", true, 10, meta.None)
require.NoError(t, err)
@ -136,7 +135,7 @@ type testData struct {
path storj.Path
}
func populateTestData(t *testing.T, planet *testplanet.Planet, expiration *timestamp.Timestamp) ([]testData, *audit.Cursor, *metainfo.Service) {
func populateTestData(t *testing.T, planet *testplanet.Planet, expiration time.Time) ([]testData, *audit.Cursor, *metainfo.Service) {
ctx := context.TODO()
tests := []testData{
{bm: "success-1", path: "folder1/file1"},
@ -166,7 +165,7 @@ func populateTestData(t *testing.T, planet *testplanet.Planet, expiration *times
return tests, cursor, metainfo
}
func makePointer(path storj.Path, expiration *timestamp.Timestamp) *pb.Pointer {
func makePointer(path storj.Path, expiration time.Time) *pb.Pointer {
var rps []*pb.RemotePiece
rps = append(rps, &pb.RemotePiece{
PieceNum: 1,

View File

@ -6,12 +6,8 @@ package kvmetainfo
import (
"context"
"errors"
"time"
"github.com/gogo/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
"go.uber.org/zap"
"storj.io/storj/internal/memory"
"storj.io/storj/pkg/encryption"
@ -272,7 +268,7 @@ func (db *DB) getInfo(ctx context.Context, bucket string, path storj.Path) (obj
lastSegmentMeta := segments.Meta{
Modified: pointer.CreationDate,
Expiration: convertTime(pointer.GetExpirationDate()),
Expiration: pointer.GetExpirationDate(),
Size: pointer.GetSegmentSize(),
Data: pointer.GetMetadata(),
}
@ -379,18 +375,6 @@ func objectStreamFromMeta(bucket storj.Bucket, path storj.Path, lastSegment segm
}, nil
}
// convertTime converts gRPC timestamp to Go time
func convertTime(ts *timestamp.Timestamp) time.Time {
if ts == nil {
return time.Time{}
}
t, err := ptypes.Timestamp(ts)
if err != nil {
zap.S().Warnf("Failed converting timestamp %v: %v", ts, err)
}
return t
}
type mutableObject struct {
db *DB
info storj.Object

View File

@ -8,7 +8,7 @@ import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
_ "github.com/golang/protobuf/ptypes/timestamp"
grpc "google.golang.org/grpc"
math "math"
time "time"
@ -633,15 +633,15 @@ func (m *AddressedOrderLimit) GetStorageNodeAddress() *NodeAddress {
}
type SegmentWriteRequestOld struct {
Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"`
Path []byte `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
Segment int64 `protobuf:"varint,3,opt,name=segment,proto3" json:"segment,omitempty"`
Redundancy *RedundancyScheme `protobuf:"bytes,4,opt,name=redundancy,proto3" json:"redundancy,omitempty"`
MaxEncryptedSegmentSize int64 `protobuf:"varint,5,opt,name=max_encrypted_segment_size,json=maxEncryptedSegmentSize,proto3" json:"max_encrypted_segment_size,omitempty"`
Expiration *timestamp.Timestamp `protobuf:"bytes,6,opt,name=expiration,proto3" json:"expiration,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Bucket []byte `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"`
Path []byte `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
Segment int64 `protobuf:"varint,3,opt,name=segment,proto3" json:"segment,omitempty"`
Redundancy *RedundancyScheme `protobuf:"bytes,4,opt,name=redundancy,proto3" json:"redundancy,omitempty"`
MaxEncryptedSegmentSize int64 `protobuf:"varint,5,opt,name=max_encrypted_segment_size,json=maxEncryptedSegmentSize,proto3" json:"max_encrypted_segment_size,omitempty"`
Expiration time.Time `protobuf:"bytes,6,opt,name=expiration,proto3,stdtime" json:"expiration"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SegmentWriteRequestOld) Reset() { *m = SegmentWriteRequestOld{} }
@ -703,11 +703,11 @@ func (m *SegmentWriteRequestOld) GetMaxEncryptedSegmentSize() int64 {
return 0
}
func (m *SegmentWriteRequestOld) GetExpiration() *timestamp.Timestamp {
func (m *SegmentWriteRequestOld) GetExpiration() time.Time {
if m != nil {
return m.Expiration
}
return nil
return time.Time{}
}
type SegmentWriteResponseOld struct {
@ -1507,95 +1507,95 @@ func init() {
func init() { proto.RegisterFile("metainfo.proto", fileDescriptor_631e2f30a93cd64e) }
var fileDescriptor_631e2f30a93cd64e = []byte{
// 1406 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4b, 0x6f, 0xdb, 0xc6,
0x16, 0xbe, 0x94, 0x6d, 0x59, 0x3a, 0x72, 0x6c, 0x67, 0xe2, 0x6b, 0x2b, 0x54, 0x1c, 0x2b, 0xcc,
0x4d, 0xa0, 0x0b, 0x5c, 0x28, 0x17, 0xce, 0x26, 0x68, 0x5a, 0xa0, 0x7e, 0xe4, 0xe1, 0x22, 0x0f,
0x83, 0x2a, 0x9a, 0x34, 0x68, 0x41, 0x50, 0xe2, 0x91, 0xc2, 0x56, 0x7c, 0x74, 0x38, 0x6a, 0x9d,
0xac, 0xfb, 0x03, 0xba, 0xc8, 0xa2, 0xff, 0xa3, 0x7f, 0xa2, 0xe8, 0xb2, 0xcb, 0x16, 0x48, 0x77,
0xfd, 0x13, 0xdd, 0x14, 0xf3, 0x12, 0x49, 0x89, 0x92, 0x93, 0xc0, 0x41, 0x77, 0x9c, 0x33, 0xdf,
0x9c, 0x39, 0xe7, 0x3b, 0xaf, 0x21, 0xac, 0x06, 0xc8, 0x5c, 0x3f, 0xec, 0x47, 0xed, 0x98, 0x46,
0x2c, 0x22, 0x15, 0xbd, 0x36, 0xd7, 0x31, 0xec, 0xd1, 0x17, 0x31, 0xf3, 0xa3, 0x50, 0xee, 0x99,
0x30, 0x88, 0x06, 0x0a, 0x67, 0xee, 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 0x15, 0x66, 0x8a, 0x79, 0xfd, 0x34, 0x98, 0xba, 0xe6, 0x09,
0xac, 0x4b, 0x5e, 0x55, 0x39, 0xf0, 0x14, 0x6b, 0xa6, 0x67, 0x8b, 0x5f, 0x5a, 0xe6, 0x95, 0x59,
0x88, 0xb4, 0xf8, 0x3e, 0x87, 0x75, 0x39, 0x21, 0x33, 0x8a, 0xa7, 0x8f, 0x4d, 0x3e, 0x08, 0x4c,
0x6b, 0x26, 0x24, 0x55, 0xdd, 0x81, 0xd5, 0x4c, 0x83, 0x17, 0x45, 0x31, 0x75, 0x2a, 0x3f, 0x59,
0xcc, 0xe6, 0x0c, 0x40, 0xaa, 0xd4, 0x01, 0xa2, 0x67, 0x64, 0xc6, 0xe2, 0xab, 0x53, 0xe7, 0xa6,
0x87, 0xb5, 0xf9, 0x9f, 0x39, 0xa0, 0x1c, 0x21, 0x32, 0x59, 0xe6, 0x12, 0x32, 0x39, 0x6a, 0x0a,
0x08, 0x99, 0x1e, 0x16, 0x9f, 0xc1, 0x5a, 0xb6, 0xa3, 0x4d, 0xc4, 0xb0, 0xb8, 0xf9, 0x67, 0x63,
0x38, 0xab, 0x81, 0x7e, 0x01, 0xe7, 0xf3, 0x69, 0xc3, 0x85, 0x39, 0x83, 0x8a, 0x9b, 0x94, 0x79,
0x75, 0x36, 0x26, 0xd5, 0xfe, 0x09, 0xd4, 0x32, 0x6d, 0x85, 0x64, 0xca, 0x61, 0xba, 0x07, 0x99,
0xdb, 0x33, 0x76, 0xa5, 0xba, 0xfd, 0xc5, 0x67, 0xa5, 0xb8, 0xdb, 0x2d, 0x8b, 0x47, 0xf2, 0xcd,
0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb9, 0xbc, 0x93, 0xd5, 0xd1, 0x12, 0x00, 0x00,
// 1404 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4b, 0x6f, 0x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x53, 0xe7, 0xa6, 0x87, 0xb5,
0xf9, 0xde, 0x31, 0x4a, 0x39, 0x40, 0x64, 0xb2, 0x1c, 0x0b, 0xc8, 0xe4, 0xa8, 0x29, 0x00, 0x64,
0x7a, 0x58, 0x7c, 0x0e, 0x2b, 0xd9, 0x8e, 0x36, 0xc1, 0x61, 0x71, 0xf3, 0xcf, 0x72, 0x38, 0xab,
0x81, 0x7e, 0x09, 0xe7, 0xf3, 0x69, 0xc3, 0x85, 0x39, 0x87, 0x8a, 0x9b, 0x94, 0x79, 0x75, 0xb6,
0x4e, 0x6a, 0xfd, 0x53, 0xa8, 0x65, 0xda, 0x0a, 0xc9, 0x94, 0xc3, 0x74, 0x0f, 0x32, 0x37, 0x67,
0xec, 0x4a, 0x73, 0xbb, 0xf3, 0xcf, 0x4a, 0x71, 0xb7, 0x5b, 0x16, 0xcf, 0xe5, 0x9b, 0xff, 0x05,
0x00, 0x00, 0xff, 0xff, 0xe0, 0xfa, 0x95, 0x5f, 0xdb, 0x12, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -108,7 +108,7 @@ message SegmentWriteRequestOld {
int64 segment = 3;
pointerdb.RedundancyScheme redundancy = 4;
int64 max_encrypted_segment_size = 5;
google.protobuf.Timestamp expiration = 6;
google.protobuf.Timestamp expiration = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
}
message SegmentWriteResponseOld {

View File

@ -8,7 +8,7 @@ import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
_ "github.com/golang/protobuf/ptypes/timestamp"
grpc "google.golang.org/grpc"
math "math"
time "time"
@ -108,12 +108,12 @@ type OrderLimit struct {
// piece which is allowed to be touched
PieceId PieceID `protobuf:"bytes,5,opt,name=piece_id,json=pieceId,proto3,customtype=PieceID" json:"piece_id"`
// limit in bytes how much can be changed
Limit int64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"`
Action PieceAction `protobuf:"varint,7,opt,name=action,proto3,enum=orders.PieceAction" json:"action,omitempty"`
PieceExpiration *timestamp.Timestamp `protobuf:"bytes,8,opt,name=piece_expiration,json=pieceExpiration,proto3" json:"piece_expiration,omitempty"`
OrderExpiration *timestamp.Timestamp `protobuf:"bytes,9,opt,name=order_expiration,json=orderExpiration,proto3" json:"order_expiration,omitempty"`
OrderCreation time.Time `protobuf:"bytes,12,opt,name=order_creation,json=orderCreation,proto3,stdtime" json:"order_creation"`
SatelliteSignature []byte `protobuf:"bytes,10,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"`
Limit int64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"`
Action PieceAction `protobuf:"varint,7,opt,name=action,proto3,enum=orders.PieceAction" json:"action,omitempty"`
PieceExpiration time.Time `protobuf:"bytes,8,opt,name=piece_expiration,json=pieceExpiration,proto3,stdtime" json:"piece_expiration"`
OrderExpiration time.Time `protobuf:"bytes,9,opt,name=order_expiration,json=orderExpiration,proto3,stdtime" json:"order_expiration"`
OrderCreation time.Time `protobuf:"bytes,12,opt,name=order_creation,json=orderCreation,proto3,stdtime" json:"order_creation"`
SatelliteSignature []byte `protobuf:"bytes,10,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"`
// satellites aren't necessarily discoverable in kademlia. this allows
// a storage node to find a satellite and handshake with it to get its key.
SatelliteAddress *NodeAddress `protobuf:"bytes,11,opt,name=satellite_address,json=satelliteAddress,proto3" json:"satellite_address,omitempty"`
@ -160,18 +160,18 @@ func (m *OrderLimit) GetAction() PieceAction {
return PieceAction_INVALID
}
func (m *OrderLimit) GetPieceExpiration() *timestamp.Timestamp {
func (m *OrderLimit) GetPieceExpiration() time.Time {
if m != nil {
return m.PieceExpiration
}
return nil
return time.Time{}
}
func (m *OrderLimit) GetOrderExpiration() *timestamp.Timestamp {
func (m *OrderLimit) GetOrderExpiration() time.Time {
if m != nil {
return m.OrderExpiration
}
return nil
return time.Time{}
}
func (m *OrderLimit) GetOrderCreation() time.Time {
@ -412,53 +412,53 @@ func init() {
func init() { proto.RegisterFile("orders.proto", fileDescriptor_e0f5d4cf0fc9e41b) }
var fileDescriptor_e0f5d4cf0fc9e41b = []byte{
// 727 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x40,
0x10, 0xed, 0xe6, 0xc3, 0x49, 0x26, 0x5f, 0xee, 0xb6, 0x42, 0x21, 0x02, 0x25, 0x84, 0x4b, 0x68,
0xa5, 0x94, 0x06, 0x09, 0xa9, 0x17, 0xa4, 0x7c, 0x58, 0xc5, 0x50, 0x95, 0x68, 0x93, 0x72, 0xe0,
0x12, 0x39, 0xf5, 0x92, 0x5a, 0x24, 0x76, 0xf0, 0x6e, 0x24, 0xd4, 0x3b, 0x77, 0xce, 0xfc, 0x17,
0xee, 0x1c, 0xf8, 0x05, 0x1c, 0xca, 0x5f, 0x41, 0x3b, 0xeb, 0xc4, 0x29, 0x14, 0x15, 0xa9, 0xb7,
0x7d, 0x33, 0xef, 0xcd, 0x78, 0x76, 0xde, 0x1a, 0x0a, 0x41, 0xe8, 0xf2, 0x50, 0xb4, 0x16, 0x61,
0x20, 0x03, 0x6a, 0x68, 0x54, 0x85, 0x69, 0x30, 0x0d, 0x74, 0xac, 0x5a, 0x9b, 0x06, 0xc1, 0x74,
0xc6, 0x0f, 0x10, 0x4d, 0x96, 0xef, 0x0f, 0xa4, 0x37, 0xe7, 0x42, 0x3a, 0xf3, 0x45, 0x44, 0x00,
0x3f, 0x70, 0xb9, 0x3e, 0x37, 0xbe, 0xa6, 0x01, 0xde, 0xa8, 0x1a, 0x27, 0xde, 0xdc, 0x93, 0xf4,
0x08, 0x8a, 0x82, 0x87, 0x9e, 0x33, 0x1b, 0xfb, 0xcb, 0xf9, 0x84, 0x87,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9e, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x71,
0xd3, 0xb9, 0x60, 0x33, 0x06, 0x00, 0x00,
// 731 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcb, 0x6e, 0x13, 0x4b,
0x10, 0x4d, 0xfb, 0x31, 0xb6, 0xcb, 0xaf, 0x49, 0x27, 0xba, 0xf2, 0xb5, 0xee, 0x95, 0x8d, 0xd9,
0x98, 0x44, 0x72, 0x88, 0x91, 0x90, 0xb2, 0x41, 0xf2, 0x63, 0x14, 0x06, 0xa2, 0xc4, 0x6a, 0x3b,
0x2c, 0xd8, 0x58, 0xe3, 0x4c, 0xe3, 0x8c, 0xb0, 0x67, 0xcc, 0x74, 0x5b, 0x42, 0xd9, 0xb3, 0xe7,
0x4b, 0xf8, 0x03, 0xf6, 0x2c, 0xf8, 0x02, 0x16, 0xe1, 0x57, 0x50, 0x57, 0x8f, 0x3d, 0x0e, 0x04,
0x41, 0x94, 0xdd, 0x9c, 0xaa, 0x73, 0xaa, 0xba, 0xba, 0x4e, 0x0f, 0x14, 0x82, 0xd0, 0xe5, 0xa1,
0x68, 0x2d, 0xc2, 0x40, 0x06, 0xd4, 0xd0, 0xa8, 0x0a, 0xd3, 0x60, 0x1a, 0xe8, 0x58, 0xb5, 0x36,
0x0d, 0x82, 0xe9, 0x8c, 0x1f, 0x20, 0x9a, 0x2c, 0xdf, 0x1c, 0x48, 0x6f, 0xce, 0x85, 0x74, 0xe6,
0x8b, 0x88, 0x00, 0x7e, 0xe0, 0x72, 0xfd, 0xdd, 0xf8, 0x94, 0x06, 0x38, 0x53, 0x35, 0x4e, 0xbc,
0xb9, 0x27, 0xe9, 0x11, 0x14, 0x05, 0x0f, 0x3d, 0x67, 0x36, 0xf6, 0x97, 0xf3, 0x09, 0x0f, 0x2b,
0xa4, 0x4e, 0x9a, 0x85, 0xee, 0xee, 0x97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xff, 0x68, 0x6d, 0x5d, 0xe7, 0x47, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -38,8 +38,8 @@ message OrderLimit {
int64 limit = 6;
PieceAction action = 7;
google.protobuf.Timestamp piece_expiration = 8;
google.protobuf.Timestamp order_expiration = 9;
google.protobuf.Timestamp piece_expiration = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp order_expiration = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp order_creation = 12 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
bytes satellite_signature = 10;

View File

@ -7,7 +7,7 @@ import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
_ "github.com/golang/protobuf/ptypes/timestamp"
math "math"
time "time"
)
@ -253,16 +253,16 @@ func (m *RemoteSegment) GetMerkleRoot() []byte {
}
type Pointer struct {
Type Pointer_DataType `protobuf:"varint,1,opt,name=type,proto3,enum=pointerdb.Pointer_DataType" json:"type,omitempty"`
InlineSegment []byte `protobuf:"bytes,3,opt,name=inline_segment,json=inlineSegment,proto3" json:"inline_segment,omitempty"`
Remote *RemoteSegment `protobuf:"bytes,4,opt,name=remote,proto3" json:"remote,omitempty"`
SegmentSize int64 `protobuf:"varint,5,opt,name=segment_size,json=segmentSize,proto3" json:"segment_size,omitempty"`
CreationDate time.Time `protobuf:"bytes,6,opt,name=creation_date,json=creationDate,proto3,stdtime" json:"creation_date"`
ExpirationDate *timestamp.Timestamp `protobuf:"bytes,7,opt,name=expiration_date,json=expirationDate,proto3" json:"expiration_date,omitempty"`
Metadata []byte `protobuf:"bytes,8,opt,name=metadata,proto3" json:"metadata,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Type Pointer_DataType `protobuf:"varint,1,opt,name=type,proto3,enum=pointerdb.Pointer_DataType" json:"type,omitempty"`
InlineSegment []byte `protobuf:"bytes,3,opt,name=inline_segment,json=inlineSegment,proto3" json:"inline_segment,omitempty"`
Remote *RemoteSegment `protobuf:"bytes,4,opt,name=remote,proto3" json:"remote,omitempty"`
SegmentSize int64 `protobuf:"varint,5,opt,name=segment_size,json=segmentSize,proto3" json:"segment_size,omitempty"`
CreationDate time.Time `protobuf:"bytes,6,opt,name=creation_date,json=creationDate,proto3,stdtime" json:"creation_date"`
ExpirationDate time.Time `protobuf:"bytes,7,opt,name=expiration_date,json=expirationDate,proto3,stdtime" json:"expiration_date"`
Metadata []byte `protobuf:"bytes,8,opt,name=metadata,proto3" json:"metadata,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Pointer) Reset() { *m = Pointer{} }
@ -324,11 +324,11 @@ func (m *Pointer) GetCreationDate() time.Time {
return time.Time{}
}
func (m *Pointer) GetExpirationDate() *timestamp.Timestamp {
func (m *Pointer) GetExpirationDate() time.Time {
if m != nil {
return m.ExpirationDate
}
return nil
return time.Time{}
}
func (m *Pointer) GetMetadata() []byte {
@ -453,51 +453,51 @@ func init() {
func init() { proto.RegisterFile("pointerdb.proto", fileDescriptor_75fef806d28fc810) }
var fileDescriptor_75fef806d28fc810 = []byte{
// 723 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xcd, 0x8e, 0xe3, 0x44,
0x10, 0x1e, 0xe7, 0xc7, 0xf1, 0x94, 0x9d, 0x9f, 0x6d, 0xad, 0xc0, 0xca, 0x22, 0x65, 0xb0, 0xb4,
0x30, 0x88, 0x95, 0x07, 0x79, 0x6f, 0xec, 0x6d, 0xc8, 0x48, 0x44, 0x5a, 0xc2, 0xa8, 0x93, 0x13,
0x17, 0xab, 0x13, 0xd7, 0x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xa6, 0x77, 0x3f, 0xfd,
0xbc, 0xbe, 0x9b, 0x38, 0xd1, 0x9f, 0x0e, 0x04, 0xaf, 0xb9, 0xd2, 0x14, 0x55, 0x25, 0x4a, 0x85,
0x24, 0x81, 0x3e, 0xd7, 0x58, 0xa8, 0xd0, 0x31, 0xf3, 0xfe, 0xe2, 0x8c, 0xb4, 0x73, 0x5c, 0xbc,
0xd0, 0x58, 0x50, 0x0b, 0x25, 0x04, 0x7a, 0x85, 0x90, 0x68, 0xf6, 0xca, 0xa3, 0x46, 0x9e, 0x22,
0xf4, 0x6a, 0x48, 0xed, 0xab, 0x98, 0xce, 0xcd, 0x74, 0x2f, 0xa9, 0x91, 0xc9, 0x0b, 0x18, 0x34,
0x59, 0x4d, 0x88, 0x9f, 0x90, 0x4f, 0x87, 0x4e, 0x5b, 0x48, 0x7d, 0x7a, 0x5c, 0xa5, 0x95, 0xc4,
0x37, 0xfc, 0x9d, 0x99, 0xb4, 0x47, 0x3d, 0xae, 0xee, 0x8d, 0x7e, 0xdb, 0xfb, 0xa5, 0x53, 0x6d,
0x36, 0xae, 0x61, 0xea, 0xe5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xaf, 0xb9, 0x48, 0x34,
0x05, 0x00, 0x00,
// 721 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcd, 0x8e, 0xdb, 0x36,
0x10, 0x5e, 0xf9, 0x47, 0xd6, 0x8e, 0xe4, 0x9f, 0x10, 0x41, 0x2b, 0x38, 0x05, 0xbc, 0x15, 0x90,
0x76, 0x8b, 0x06, 0xda, 0x42, 0xb9, 0x35, 0xb7, 0x85, 0x17, 0xa8, 0x81, 0xc4, 0x5d, 0xd0, 0x3e,
0xf5, 0x22, 0xd0, 0xd6, 0xc4, 0x22, 0x6a, 0x89, 0x0a, 0x49, 0x03, 0xd9, 0x7d, 0x8a, 0x5c,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, 0x13, 0xfd, 0xe9, 0x40, 0xf0, 0x9a, 0x2b, 0x4d, 0x51, 0x55, 0xa2, 0x54, 0x48, 0x12,
0xe8, 0x73, 0x8d, 0x85, 0x0a, 0x1d, 0x33, 0xf9, 0x6f, 0xce, 0xe8, 0x3b, 0xc7, 0xc5, 0x0b, 0x8d,
0x05, 0xb5, 0x50, 0x42, 0xa0, 0x57, 0x08, 0x89, 0x66, 0xc3, 0x3c, 0x6a, 0xe4, 0x29, 0x42, 0xaf,
0x86, 0xd4, 0xbe, 0x8a, 0xe9, 0xdc, 0xcc, 0xf9, 0x92, 0x1a, 0x99, 0xbc, 0x80, 0x41, 0x93, 0xd5,
0x84, 0xf8, 0x09, 0xf9, 0x72, 0xfc, 0xb4, 0x85, 0xd4, 0x47, 0xc8, 0x55, 0x5a, 0x49, 0x7c, 0xcb,
0xdf, 0x9b, 0x99, 0x7b, 0xd4, 0xe3, 0xea, 0xde, 0xe8, 0xb7, 0xbd, 0xdf, 0x3a, 0xd5, 0x66, 0xe3,
0x1a, 0xce, 0x5e, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0x35, 0x37, 0x11, 0xe0, 0x3e, 0x05, 0x00,
0x00,
}

View File

@ -52,7 +52,7 @@ message Pointer {
int64 segment_size = 5;
google.protobuf.Timestamp creation_date = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp expiration_date = 7;
google.protobuf.Timestamp expiration_date = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
bytes metadata = 8;
}

View File

@ -12,7 +12,6 @@ import (
"testing"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/vivint/infectious"
@ -150,10 +149,7 @@ func newAddressedOrderLimit(ctx context.Context, action pb.PieceAction, satellit
// TODO refactor to avoid OrderLimit duplication
serialNumber := testrand.SerialNumber()
orderExpiration, err := ptypes.TimestampProto(time.Now().Add(24 * time.Hour))
if err != nil {
return nil, err
}
now := time.Now()
limit := &pb.OrderLimit{
SerialNumber: serialNumber,
@ -163,12 +159,12 @@ func newAddressedOrderLimit(ctx context.Context, action pb.PieceAction, satellit
PieceId: pieceID,
Action: action,
Limit: dataSize.Int64(),
PieceExpiration: nil,
OrderCreation: time.Now(),
OrderExpiration: orderExpiration,
PieceExpiration: time.Time{},
OrderCreation: now,
OrderExpiration: now.Add(24 * time.Hour),
}
limit, err = signing.SignOrderLimit(ctx, signing.SignerFromFullIdentity(satellite.Identity), limit)
limit, err := signing.SignOrderLimit(ctx, signing.SignerFromFullIdentity(satellite.Identity), limit)
if err != nil {
return nil, err
}

View File

@ -153,7 +153,7 @@ func (repairer *Repairer) Repair(ctx context.Context, path storj.Path) (err erro
defer func() { err = errs.Combine(err, r.Close()) }()
// Upload the repaired pieces
successfulNodes, hashes, err := repairer.ec.Repair(ctx, putLimits, redundancy, r, convertTime(expiration), repairer.timeout, path)
successfulNodes, hashes, err := repairer.ec.Repair(ctx, putLimits, redundancy, r, expiration, repairer.timeout, path)
if err != nil {
return Error.Wrap(err)
}

View File

@ -11,10 +11,7 @@ import (
"strings"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
"go.uber.org/zap"
monkit "gopkg.in/spacemonkeygo/monkit.v2"
"gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/pkg/eestream"
"storj.io/storj/pkg/pb"
@ -101,14 +98,6 @@ func (s *segmentStore) Put(ctx context.Context, data io.Reader, expiration time.
ErasureShareSize: int32(s.rs.ErasureShareSize()),
}
var exp *timestamp.Timestamp
if !expiration.IsZero() {
exp, err = ptypes.TimestampProto(expiration)
if err != nil {
return Meta{}, Error.Wrap(err)
}
}
peekReader := NewPeekThresholdReader(data)
remoteSized, err := peekReader.IsLargerThan(s.thresholdSize)
if err != nil {
@ -130,7 +119,7 @@ func (s *segmentStore) Put(ctx context.Context, data io.Reader, expiration time.
Type: pb.Pointer_INLINE,
InlineSegment: peekReader.thresholdBuf,
SegmentSize: int64(len(peekReader.thresholdBuf)),
ExpirationDate: exp,
ExpirationDate: expiration,
Metadata: metadata,
}
} else {
@ -163,7 +152,7 @@ func (s *segmentStore) Put(ctx context.Context, data io.Reader, expiration time.
}
path = p
pointer, err = makeRemotePointer(successfulNodes, successfulHashes, s.rs, rootPieceID, sizedReader.Size(), exp, metadata)
pointer, err = makeRemotePointer(successfulNodes, successfulHashes, s.rs, rootPieceID, sizedReader.Size(), expiration, metadata)
if err != nil {
return Meta{}, Error.Wrap(err)
}
@ -239,7 +228,7 @@ func (s *segmentStore) Get(ctx context.Context, path storj.Path) (rr ranger.Rang
}
// makeRemotePointer creates a pointer of type remote
func makeRemotePointer(nodes []*pb.Node, hashes []*pb.PieceHash, rs eestream.RedundancyStrategy, pieceID storj.PieceID, readerSize int64, exp *timestamp.Timestamp, metadata []byte) (pointer *pb.Pointer, err error) {
func makeRemotePointer(nodes []*pb.Node, hashes []*pb.PieceHash, rs eestream.RedundancyStrategy, pieceID storj.PieceID, readerSize int64, expiration time.Time, metadata []byte) (pointer *pb.Pointer, err error) {
if len(nodes) != len(hashes) {
return nil, Error.New("unable to make pointer: size of nodes != size of hashes")
}
@ -272,7 +261,7 @@ func makeRemotePointer(nodes []*pb.Node, hashes []*pb.PieceHash, rs eestream.Red
RemotePieces: remotePieces,
},
SegmentSize: readerSize,
ExpirationDate: exp,
ExpirationDate: expiration,
Metadata: metadata,
}
return pointer, nil
@ -359,24 +348,12 @@ func CalcNeededNodes(rs *pb.RedundancyScheme) int32 {
func convertMeta(pr *pb.Pointer) Meta {
return Meta{
Modified: pr.GetCreationDate(),
Expiration: convertTime(pr.GetExpirationDate()),
Expiration: pr.GetExpirationDate(),
Size: pr.GetSegmentSize(),
Data: pr.GetMetadata(),
}
}
// convertTime converts gRPC timestamp to Go time
func convertTime(ts *timestamp.Timestamp) time.Time {
if ts == nil {
return time.Time{}
}
t, err := ptypes.Timestamp(ts)
if err != nil {
zap.S().Warnf("Failed converting timestamp %v: %v", ts, err)
}
return t
}
func splitPathFragments(path storj.Path) (bucket string, objectPath storj.Path, segmentIndex int64, err error) {
components := storj.SplitPath(path)
if len(components) < 1 {

View File

@ -1859,7 +1859,17 @@
{
"id": 6,
"name": "expiration",
"type": "google.protobuf.Timestamp"
"type": "google.protobuf.Timestamp",
"options": [
{
"name": "(gogoproto.stdtime)",
"value": "true"
},
{
"name": "(gogoproto.nullable)",
"value": "false"
}
]
}
]
},
@ -2786,12 +2796,32 @@
{
"id": 8,
"name": "piece_expiration",
"type": "google.protobuf.Timestamp"
"type": "google.protobuf.Timestamp",
"options": [
{
"name": "(gogoproto.stdtime)",
"value": "true"
},
{
"name": "(gogoproto.nullable)",
"value": "false"
}
]
},
{
"id": 9,
"name": "order_expiration",
"type": "google.protobuf.Timestamp"
"type": "google.protobuf.Timestamp",
"options": [
{
"name": "(gogoproto.stdtime)",
"value": "true"
},
{
"name": "(gogoproto.nullable)",
"value": "false"
}
]
},
{
"id": 12,
@ -3502,7 +3532,17 @@
{
"id": 7,
"name": "expiration_date",
"type": "google.protobuf.Timestamp"
"type": "google.protobuf.Timestamp",
"options": [
{
"name": "(gogoproto.stdtime)",
"value": "true"
},
{
"name": "(gogoproto.nullable)",
"value": "false"
}
]
},
{
"id": 8,

View File

@ -10,7 +10,6 @@ import (
"strconv"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/skyrings/skyring-common/tools/uuid"
"github.com/zeebo/errs"
"go.uber.org/zap"
@ -130,15 +129,8 @@ func (endpoint *Endpoint) SegmentInfoOld(ctx context.Context, req *pb.SegmentInf
func (endpoint *Endpoint) CreateSegmentOld(ctx context.Context, req *pb.SegmentWriteRequestOld) (resp *pb.SegmentWriteResponseOld, err error) {
defer mon.Task()(&ctx)(&err)
if req.Expiration != nil {
exp, err := ptypes.Timestamp(req.Expiration)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}
if !exp.After(time.Now()) {
return nil, errs.New("Invalid expiration time")
}
if !req.Expiration.IsZero() && !req.Expiration.After(time.Now()) {
return nil, errs.New("Invalid expiration time")
}
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{

View File

@ -9,7 +9,6 @@ import (
"testing"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zeebo/errs"
@ -329,9 +328,6 @@ func TestCommitSegment(t *testing.T) {
}
}
expirationDateProto, err := ptypes.TimestampProto(expirationDate)
require.NoError(t, err)
pointer := &pb.Pointer{
CreationDate: time.Now(),
Type: pb.Pointer_REMOTE,
@ -341,7 +337,7 @@ func TestCommitSegment(t *testing.T) {
Redundancy: redundancy,
RemotePieces: pieces,
},
ExpirationDate: expirationDateProto,
ExpirationDate: expirationDate,
}
limits := make([]*pb.OrderLimit, len(addresedLimits))
@ -528,7 +524,7 @@ func TestCommitSegmentPointer(t *testing.T) {
}{
{
Modify: func(pointer *pb.Pointer) {
pointer.ExpirationDate.Seconds += 100
pointer.ExpirationDate = pointer.ExpirationDate.Add(time.Second * 100)
},
ErrorMessage: "pointer expiration date does not match requested one",
},
@ -708,10 +704,8 @@ func TestGetProjectInfo(t *testing.T) {
func runCreateSegment(ctx context.Context, t *testing.T, metainfo *metainfo.Client) (*pb.Pointer, []*pb.OrderLimit) {
pointer := createTestPointer(t)
expirationDate, err := ptypes.Timestamp(pointer.ExpirationDate)
require.NoError(t, err)
addressedLimits, rootPieceID, err := metainfo.CreateSegment(ctx, "my-bucket-name", "file/path", -1, pointer.Remote.Redundancy, memory.MiB.Int64(), expirationDate)
addressedLimits, rootPieceID, err := metainfo.CreateSegment(ctx, "my-bucket-name", "file/path", -1, pointer.Remote.Redundancy, memory.MiB.Int64(), pointer.ExpirationDate)
require.NoError(t, err)
pointer.Remote.RootPieceId = rootPieceID
@ -744,8 +738,6 @@ func createTestPointer(t *testing.T) *pb.Pointer {
segmentSize := 4 * memory.KiB.Int64()
pieceSize := eestream.CalcPieceSize(segmentSize, redundancy)
timestamp := time.Now().Add(time.Hour)
expiration, err := ptypes.TimestampProto(timestamp)
require.NoError(t, err)
pointer := &pb.Pointer{
CreationDate: time.Now(),
Type: pb.Pointer_REMOTE,
@ -769,7 +761,7 @@ func createTestPointer(t *testing.T) *pb.Pointer {
},
},
},
ExpirationDate: expiration,
ExpirationDate: timestamp,
}
return pointer
}

View File

@ -11,7 +11,6 @@ import (
"time"
"github.com/gogo/protobuf/proto"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/zeebo/errs"
"go.uber.org/zap"
"google.golang.org/grpc/codes"
@ -39,7 +38,7 @@ type TTLItem struct {
}
type createRequest struct {
Expiration *timestamp.Timestamp
Expiration time.Time
Redundancy *pb.RedundancyScheme
ttl time.Time
@ -220,7 +219,7 @@ func (endpoint *Endpoint) validateCommitSegment(ctx context.Context, req *pb.Seg
switch {
case !found:
return Error.New("missing create request or request expired")
case !proto.Equal(createRequest.Expiration, req.Pointer.ExpirationDate):
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):
return Error.New("pointer redundancy scheme date does not match requested one")

View File

@ -8,13 +8,12 @@ import (
"io"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/skyrings/skyring-common/tools/uuid"
"github.com/zeebo/errs"
"go.uber.org/zap"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
monkit "gopkg.in/spacemonkeygo/monkit.v2"
"gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/pkg/auth/signing"
"storj.io/storj/pkg/certdb"
@ -138,11 +137,6 @@ func (endpoint *Endpoint) Settlement(stream pb.Orders_SettlementServer) (err err
return status.Error(codes.Unauthenticated, "only specified storage node can settle order")
}
orderExpiration, err := ptypes.Timestamp(orderLimit.OrderExpiration)
if err != nil {
return status.Errorf(codes.InvalidArgument, err.Error())
}
rejectErr := func() error {
var uplinkSignee signing.Signee
@ -174,7 +168,7 @@ func (endpoint *Endpoint) Settlement(stream pb.Orders_SettlementServer) (err err
return Error.New("invalid serial number")
}
if orderExpiration.Before(time.Now()) {
if orderLimit.OrderExpiration.Before(time.Now()) {
return Error.New("order limit expired")
}
return nil

View File

@ -8,8 +8,6 @@ import (
"context"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/skyrings/skyring-common/tools/uuid"
"github.com/zeebo/errs"
"go.uber.org/zap"
@ -121,14 +119,8 @@ func (service *Service) updateBandwidth(ctx context.Context, projectID uuid.UUID
func (service *Service) CreateGetOrderLimits(ctx context.Context, uplink *identity.PeerIdentity, bucketID []byte, pointer *pb.Pointer) (_ []*pb.AddressedOrderLimit, err error) {
defer mon.Task()(&ctx)(&err)
rootPieceID := pointer.GetRemote().RootPieceId
expiration := pointer.ExpirationDate
// convert orderExpiration from duration to timestamp
orderExpirationTime := time.Now().UTC().Add(service.orderExpiration)
orderExpiration, err := ptypes.TimestampProto(orderExpirationTime)
if err != nil {
return nil, Error.Wrap(err)
}
pieceExpiration := pointer.ExpirationDate
orderExpiration := time.Now().Add(service.orderExpiration)
serialNumber, err := service.createSerial(ctx)
if err != nil {
@ -173,7 +165,7 @@ func (service *Service) CreateGetOrderLimits(ctx context.Context, uplink *identi
PieceId: rootPieceID.Derive(piece.NodeId, piece.PieceNum),
Action: pb.PieceAction_GET,
Limit: pieceSize,
PieceExpiration: expiration,
PieceExpiration: pieceExpiration,
OrderCreation: time.Now(),
OrderExpiration: orderExpiration,
})
@ -197,7 +189,7 @@ func (service *Service) CreateGetOrderLimits(ctx context.Context, uplink *identi
return nil, Error.Wrap(err)
}
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpirationTime)
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration)
if err != nil {
return nil, Error.Wrap(err)
}
@ -214,14 +206,10 @@ func (service *Service) CreateGetOrderLimits(ctx context.Context, uplink *identi
}
// CreatePutOrderLimits creates the order limits for uploading pieces to nodes.
func (service *Service) CreatePutOrderLimits(ctx context.Context, uplink *identity.PeerIdentity, bucketID []byte, nodes []*pb.Node, expiration *timestamp.Timestamp, maxPieceSize int64) (_ storj.PieceID, _ []*pb.AddressedOrderLimit, err error) {
func (service *Service) CreatePutOrderLimits(ctx context.Context, uplink *identity.PeerIdentity, bucketID []byte, nodes []*pb.Node, expiration time.Time, maxPieceSize int64) (_ storj.PieceID, _ []*pb.AddressedOrderLimit, err error) {
defer mon.Task()(&ctx)(&err)
// convert orderExpiration from duration to timestamp
orderExpirationTime := time.Now().UTC().Add(service.orderExpiration)
orderExpiration, err := ptypes.TimestampProto(orderExpirationTime)
if err != nil {
return storj.PieceID{}, nil, Error.Wrap(err)
}
orderExpiration := time.Now().Add(service.orderExpiration)
serialNumber, err := service.createSerial(ctx)
if err != nil {
@ -261,7 +249,7 @@ func (service *Service) CreatePutOrderLimits(ctx context.Context, uplink *identi
return storj.PieceID{}, nil, Error.Wrap(err)
}
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpirationTime)
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration)
if err != nil {
return storj.PieceID{}, nil, Error.Wrap(err)
}
@ -281,14 +269,8 @@ func (service *Service) CreatePutOrderLimits(ctx context.Context, uplink *identi
func (service *Service) CreateDeleteOrderLimits(ctx context.Context, uplink *identity.PeerIdentity, bucketID []byte, pointer *pb.Pointer) (_ []*pb.AddressedOrderLimit, err error) {
defer mon.Task()(&ctx)(&err)
rootPieceID := pointer.GetRemote().RootPieceId
expiration := pointer.ExpirationDate
// convert orderExpiration from duration to timestamp
orderExpirationTime := time.Now().UTC().Add(service.orderExpiration)
orderExpiration, err := ptypes.TimestampProto(orderExpirationTime)
if err != nil {
return nil, Error.Wrap(err)
}
pieceExpiration := pointer.ExpirationDate
orderExpiration := time.Now().Add(service.orderExpiration)
serialNumber, err := service.createSerial(ctx)
if err != nil {
@ -326,7 +308,7 @@ func (service *Service) CreateDeleteOrderLimits(ctx context.Context, uplink *ide
PieceId: rootPieceID.Derive(piece.NodeId, piece.PieceNum),
Action: pb.PieceAction_DELETE,
Limit: 0,
PieceExpiration: expiration,
PieceExpiration: pieceExpiration,
OrderCreation: time.Now(),
OrderExpiration: orderExpiration,
})
@ -350,7 +332,7 @@ func (service *Service) CreateDeleteOrderLimits(ctx context.Context, uplink *ide
return nil, Error.Wrap(err)
}
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpirationTime)
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration)
if err != nil {
return nil, Error.Wrap(err)
}
@ -365,14 +347,8 @@ func (service *Service) CreateAuditOrderLimits(ctx context.Context, auditor *ide
redundancy := pointer.GetRemote().GetRedundancy()
shareSize := redundancy.GetErasureShareSize()
totalPieces := redundancy.GetTotal()
expiration := pointer.ExpirationDate
// convert orderExpiration from duration to timestamp
orderExpirationTime := time.Now().UTC().Add(service.orderExpiration)
orderExpiration, err := ptypes.TimestampProto(orderExpirationTime)
if err != nil {
return nil, Error.Wrap(err)
}
pieceExpiration := pointer.ExpirationDate
orderExpiration := time.Now().Add(service.orderExpiration)
serialNumber, err := service.createSerial(ctx)
if err != nil {
@ -415,7 +391,7 @@ func (service *Service) CreateAuditOrderLimits(ctx context.Context, auditor *ide
PieceId: rootPieceID.Derive(piece.NodeId, piece.PieceNum),
Action: pb.PieceAction_GET_AUDIT,
Limit: int64(shareSize),
PieceExpiration: expiration,
PieceExpiration: pieceExpiration,
OrderCreation: time.Now(),
OrderExpiration: orderExpiration,
})
@ -435,7 +411,7 @@ func (service *Service) CreateAuditOrderLimits(ctx context.Context, auditor *ide
return nil, errs.Combine(err, combinedErrs)
}
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpirationTime)
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration)
if err != nil {
return nil, Error.Wrap(err)
}
@ -455,12 +431,8 @@ func (service *Service) CreateAuditOrderLimits(ctx context.Context, auditor *ide
func (service *Service) CreateAuditOrderLimit(ctx context.Context, auditor *identity.PeerIdentity, bucketID []byte, nodeID storj.NodeID, pieceNum int32, rootPieceID storj.PieceID, shareSize int32) (limit *pb.AddressedOrderLimit, err error) {
// TODO reduce number of params ?
defer mon.Task()(&ctx)(&err)
// convert orderExpiration from duration to timestamp
orderExpirationTime := time.Now().UTC().Add(service.orderExpiration)
orderExpiration, err := ptypes.TimestampProto(orderExpirationTime)
if err != nil {
return nil, Error.Wrap(err)
}
orderExpiration := time.Now().Add(service.orderExpiration)
serialNumber, err := service.createSerial(ctx)
if err != nil {
@ -501,7 +473,7 @@ func (service *Service) CreateAuditOrderLimit(ctx context.Context, auditor *iden
StorageNodeAddress: node.Address,
}
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpirationTime)
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration)
if err != nil {
return nil, Error.Wrap(err)
}
@ -527,14 +499,8 @@ func (service *Service) CreateGetRepairOrderLimits(ctx context.Context, repairer
}
pieceSize := eestream.CalcPieceSize(pointer.GetSegmentSize(), redundancy)
totalPieces := redundancy.TotalCount()
expiration := pointer.ExpirationDate
// convert orderExpiration from duration to timestamp
orderExpirationTime := time.Now().UTC().Add(service.orderExpiration)
orderExpiration, err := ptypes.TimestampProto(orderExpirationTime)
if err != nil {
return nil, Error.Wrap(err)
}
pieceExpiration := pointer.ExpirationDate
orderExpiration := time.Now().Add(service.orderExpiration)
serialNumber, err := service.createSerial(ctx)
if err != nil {
@ -573,7 +539,7 @@ func (service *Service) CreateGetRepairOrderLimits(ctx context.Context, repairer
PieceId: rootPieceID.Derive(piece.NodeId, piece.PieceNum),
Action: pb.PieceAction_GET_REPAIR,
Limit: pieceSize,
PieceExpiration: expiration,
PieceExpiration: pieceExpiration,
OrderCreation: time.Now(),
OrderExpiration: orderExpiration,
})
@ -593,7 +559,7 @@ func (service *Service) CreateGetRepairOrderLimits(ctx context.Context, repairer
return nil, errs.Combine(err, combinedErrs)
}
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpirationTime)
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration)
if err != nil {
return nil, Error.Wrap(err)
}
@ -619,14 +585,8 @@ func (service *Service) CreatePutRepairOrderLimits(ctx context.Context, repairer
}
pieceSize := eestream.CalcPieceSize(pointer.GetSegmentSize(), redundancy)
totalPieces := redundancy.TotalCount()
expiration := pointer.ExpirationDate
// convert orderExpiration from duration to timestamp
orderExpirationTime := time.Now().UTC().Add(service.orderExpiration)
orderExpiration, err := ptypes.TimestampProto(orderExpirationTime)
if err != nil {
return nil, Error.Wrap(err)
}
pieceExpiration := pointer.ExpirationDate
orderExpiration := time.Now().Add(service.orderExpiration)
serialNumber, err := service.createSerial(ctx)
if err != nil {
@ -653,7 +613,7 @@ func (service *Service) CreatePutRepairOrderLimits(ctx context.Context, repairer
PieceId: rootPieceID.Derive(node.Id, pieceNum),
Action: pb.PieceAction_PUT_REPAIR,
Limit: pieceSize,
PieceExpiration: expiration,
PieceExpiration: pieceExpiration,
OrderCreation: time.Now(),
OrderExpiration: orderExpiration,
})
@ -668,7 +628,7 @@ func (service *Service) CreatePutRepairOrderLimits(ctx context.Context, repairer
pieceNum++
}
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpirationTime)
err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration)
if err != nil {
return nil, Error.Wrap(err)
}

View File

@ -5,10 +5,11 @@ package pbold
import (
fmt "fmt"
math "math"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
_ "github.com/golang/protobuf/ptypes/duration"
math "math"
pb "storj.io/storj/pkg/pb"
)
@ -65,8 +66,8 @@ func (BandwidthAction) EnumDescriptor() ([]byte, []int) {
}
type PayerBandwidthAllocation struct {
SatelliteId pb.NodeID `protobuf:"bytes,1,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"`
UplinkId pb.NodeID `protobuf:"bytes,2,opt,name=uplink_id,json=uplinkId,proto3,customtype=NodeID" json:"uplink_id"`
SatelliteId pb.NodeID `protobuf:"bytes,1,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"`
UplinkId pb.NodeID `protobuf:"bytes,2,opt,name=uplink_id,json=uplinkId,proto3,customtype=NodeID" json:"uplink_id"`
MaxSize int64 `protobuf:"varint,3,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"`
ExpirationUnixSec int64 `protobuf:"varint,4,opt,name=expiration_unix_sec,json=expirationUnixSec,proto3" json:"expiration_unix_sec,omitempty"`
SerialNumber string `protobuf:"bytes,5,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"`

View File

@ -7,7 +7,6 @@ import (
"testing"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
@ -48,8 +47,6 @@ func TestOrders(t *testing.T) {
require.Len(t, emptyArchive, 0)
now := time.Now()
nowTimestamp, err := ptypes.TimestampProto(now)
require.NoError(t, err)
limit, err := signing.SignOrderLimit(ctx, signing.SignerFromFullIdentity(satellite0), &pb.OrderLimit{
SerialNumber: serialNumber,
@ -60,8 +57,8 @@ func TestOrders(t *testing.T) {
Limit: 100,
Action: pb.PieceAction_GET,
OrderCreation: now.AddDate(0, 0, -1),
PieceExpiration: nowTimestamp,
OrderExpiration: nowTimestamp,
PieceExpiration: now,
OrderExpiration: now,
})
require.NoError(t, err)

View File

@ -53,8 +53,8 @@ func TestPieceInfo(t *testing.T) {
PieceID: pieceid0,
PieceSize: 123,
PieceCreation: &now,
PieceExpiration: &now,
PieceCreation: now,
PieceExpiration: now,
UplinkPieceHash: piecehash0,
}
@ -72,8 +72,8 @@ func TestPieceInfo(t *testing.T) {
PieceID: pieceid0,
PieceSize: 123,
PieceCreation: &now,
PieceExpiration: &now,
PieceCreation: now,
PieceExpiration: now,
UplinkPieceHash: piecehash1,
}
@ -91,8 +91,8 @@ func TestPieceInfo(t *testing.T) {
PieceID: pieceid0,
PieceSize: 123,
PieceCreation: &now,
PieceExpiration: &now,
PieceCreation: now,
PieceExpiration: now,
UplinkPieceHash: piecehash2,
}

View File

@ -38,8 +38,8 @@ type Info struct {
PieceID storj.PieceID
PieceSize int64
PieceCreation *time.Time
PieceExpiration *time.Time
PieceCreation time.Time
PieceExpiration time.Time
UplinkPieceHash *pb.PieceHash
Uplink *identity.PeerIdentity

View File

@ -10,13 +10,12 @@ import (
"sync/atomic"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/zeebo/errs"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
monkit "gopkg.in/spacemonkeygo/monkit.v2"
"gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/internal/memory"
"storj.io/storj/internal/sync2"
@ -292,23 +291,14 @@ func (endpoint *Endpoint) Upload(stream pb.Piecestore_UploadServer) (err error)
// TODO: do this in a goroutine
{
var expiration *time.Time
if limit.PieceExpiration != nil {
exp, err := ptypes.Timestamp(limit.PieceExpiration)
if err != nil {
return ErrInternal.Wrap(err)
}
expiration = &exp
}
// TODO: maybe this should be as a pieceWriter.Commit(ctx, info)
info := &pieces.Info{
SatelliteID: limit.SatelliteId,
PieceID: limit.PieceId,
PieceSize: pieceWriter.Size(),
PieceCreation: &limit.OrderCreation,
PieceExpiration: expiration,
PieceCreation: limit.OrderCreation,
PieceExpiration: limit.PieceExpiration,
UplinkPieceHash: message.Done,
Uplink: peer,

View File

@ -10,7 +10,6 @@ import (
"testing"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zeebo/errs"
@ -485,11 +484,7 @@ func TestTooManyRequests(t *testing.T) {
func GenerateOrderLimit(t *testing.T, satellite storj.NodeID, uplink storj.NodeID, storageNode storj.NodeID, pieceID storj.PieceID,
action pb.PieceAction, serialNumber storj.SerialNumber, pieceExpiration, orderExpiration time.Duration, limit int64) *pb.OrderLimit {
pe, err := ptypes.TimestampProto(time.Now().Add(pieceExpiration))
require.NoError(t, err)
oe, err := ptypes.TimestampProto(time.Now().Add(orderExpiration))
require.NoError(t, err)
now := time.Now()
return &pb.OrderLimit{
SatelliteId: satellite,
@ -499,8 +494,8 @@ func GenerateOrderLimit(t *testing.T, satellite storj.NodeID, uplink storj.NodeI
Action: action,
SerialNumber: serialNumber,
OrderCreation: time.Now(),
OrderExpiration: oe,
PieceExpiration: pe,
OrderExpiration: now.Add(orderExpiration),
PieceExpiration: now.Add(pieceExpiration),
Limit: limit,
}
}

View File

@ -8,8 +8,6 @@ import (
"context"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/zeebo/errs"
"storj.io/storj/internal/errs2"
@ -39,7 +37,7 @@ func (endpoint *Endpoint) VerifyOrderLimit(ctx context.Context, limit *pb.OrderL
return ErrProtocol.New("order limit is negative")
case endpoint.signer.ID() != limit.StorageNodeId:
return ErrProtocol.New("order intended for other storagenode: %v", limit.StorageNodeId)
case limit.PieceExpiration != nil && endpoint.IsExpired(limit.PieceExpiration):
case endpoint.IsExpired(limit.PieceExpiration):
return ErrProtocol.New("piece expired: %v", limit.PieceExpiration)
case endpoint.IsExpired(limit.OrderExpiration):
return ErrProtocol.New("order expired: %v", limit.OrderExpiration)
@ -77,10 +75,7 @@ func (endpoint *Endpoint) VerifyOrderLimit(ctx context.Context, limit *pb.OrderL
return ErrVerifyUntrusted.Wrap(err)
}
serialExpiration, err := ptypes.Timestamp(limit.OrderExpiration)
if err != nil {
return ErrInternal.Wrap(err)
}
serialExpiration := limit.OrderExpiration
// Expire the serial earlier if the grace period is smaller than the serial expiration.
if graceExpiration := now.Add(endpoint.config.OrderLimitGracePeriod); graceExpiration.Before(serialExpiration) {
@ -157,17 +152,11 @@ func (endpoint *Endpoint) VerifyOrderLimitSignature(ctx context.Context, limit *
}
// IsExpired checks whether the date has already expired (with a threshold) at the time of calling this function.
func (endpoint *Endpoint) IsExpired(expiration *timestamp.Timestamp) bool {
if expiration == nil {
return true
}
expirationTime, err := ptypes.Timestamp(expiration)
if err != nil {
// TODO: return error
return true
func (endpoint *Endpoint) IsExpired(expiration time.Time) bool {
if expiration.IsZero() {
return false
}
// TODO: return specific error about either exceeding the expiration completely or just the grace period
return expirationTime.Before(time.Now().Add(-endpoint.config.ExpirationGracePeriod))
return expiration.Before(time.Now().Add(-endpoint.config.ExpirationGracePeriod))
}

View File

@ -327,7 +327,8 @@ func setSpace(ctx context.Context, t *testing.T, planet *testplanet.Planet, spac
SatelliteID: planet.Satellites[0].ID(),
PieceID: storj.PieceID{99},
PieceSize: diff,
PieceCreation: &now,
PieceCreation: now,
PieceExpiration: time.Time{},
Uplink: planet.Uplinks[0].Identity.PeerIdentity(),
UplinkPieceHash: &pb.PieceHash{},
})

View File

@ -9,7 +9,6 @@ import (
"time"
"github.com/gogo/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/zeebo/errs"
"storj.io/storj/pkg/pb"
@ -39,19 +38,13 @@ func (db *ordersdb) Enqueue(ctx context.Context, info *orders.Info) (err error)
return ErrInfo.Wrap(err)
}
expirationTime, err := ptypes.Timestamp(info.Limit.OrderExpiration)
if err != nil {
return ErrInfo.Wrap(err)
}
// TODO remove `uplink_cert_id` from DB
_, err = db.db.Exec(`
INSERT INTO unsent_order(
satellite_id, serial_number,
order_limit_serialized, order_serialized, order_limit_expiration,
uplink_cert_id
) VALUES (?,?, ?,?,?, ?)
`, info.Limit.SatelliteId, info.Limit.SerialNumber, limitSerialized, orderSerialized, expirationTime, 0)
`, info.Limit.SatelliteId, info.Limit.SerialNumber, limitSerialized, orderSerialized, info.Limit.OrderExpiration.UTC(), 0)
return ErrInfo.Wrap(err)
}

View File

@ -7,8 +7,8 @@ import (
"runtime"
"sync"
"testing"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/skyrings/skyring-common/tools/uuid"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
@ -139,7 +139,7 @@ func createOrder(t *testing.T, ctx *testcontext.Context) (info *orders.Info) {
piece := storj.NewPieceID()
serialNumber := testrand.SerialNumber()
exp := ptypes.TimestampNow()
expiration := time.Now()
limit, err := signing.SignOrderLimit(ctx, signing.SignerFromFullIdentity(satelliteIdentity), &pb.OrderLimit{
SerialNumber: serialNumber,
@ -149,8 +149,8 @@ func createOrder(t *testing.T, ctx *testcontext.Context) (info *orders.Info) {
PieceId: piece,
Limit: 100,
Action: pb.PieceAction_GET,
PieceExpiration: exp,
OrderExpiration: exp,
PieceExpiration: expiration,
OrderExpiration: expiration,
})
require.NoError(t, err)

View File

@ -7,14 +7,12 @@ import (
"context"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/skyrings/skyring-common/tools/uuid"
"github.com/zeebo/errs"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
monkit "gopkg.in/spacemonkeygo/monkit.v2"
"gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/pkg/auth/grpcauth"
"storj.io/storj/pkg/pb"
@ -80,21 +78,13 @@ func (client *Client) Close() error {
func (client *Client) CreateSegment(ctx context.Context, bucket string, path storj.Path, segmentIndex int64, redundancy *pb.RedundancyScheme, maxEncryptedSegmentSize int64, expiration time.Time) (limits []*pb.AddressedOrderLimit, rootPieceID storj.PieceID, err error) {
defer mon.Task()(&ctx)(&err)
var exp *timestamp.Timestamp
if !expiration.IsZero() {
exp, err = ptypes.TimestampProto(expiration)
if err != nil {
return nil, rootPieceID, err
}
}
response, err := client.client.CreateSegmentOld(ctx, &pb.SegmentWriteRequestOld{
Bucket: []byte(bucket),
Path: []byte(path),
Segment: segmentIndex,
Redundancy: redundancy,
MaxEncryptedSegmentSize: maxEncryptedSegmentSize,
Expiration: exp,
Expiration: expiration,
})
if err != nil {
return nil, rootPieceID, Error.Wrap(err)