Keep track of used space (#338)

* Keep track of space at all times

* Create index on expires

* Updated mock psclient
This commit is contained in:
Alexander Leitner 2018-09-11 08:40:45 -04:00 committed by GitHub
parent 6ee6f0fdf5
commit 8f07c4d746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 276 additions and 57 deletions

View File

@ -182,6 +182,14 @@ func main() {
return err
},
},
{
Name: "stat",
Aliases: []string{"s"},
Usage: "retrieve stats",
Action: func(c *cli.Context) error {
return psClient.Stats(context.Background())
},
},
}
err = app.Run(os.Args)

View File

@ -42,6 +42,7 @@ type PSClient interface {
Put(ctx context.Context, id PieceID, data io.Reader, ttl time.Time, ba *pb.PayerBandwidthAllocation) error
Get(ctx context.Context, id PieceID, size int64, ba *pb.PayerBandwidthAllocation) (ranger.RangeCloser, error)
Delete(ctx context.Context, pieceID PieceID) error
Stats(ctx context.Context) error
io.Closer
}
@ -157,6 +158,17 @@ func (client *Client) Delete(ctx context.Context, id PieceID) error {
return nil
}
// Stats will retrieve stats about a piece storage node
func (client *Client) Stats(ctx context.Context) error {
reply, err := client.route.Stats(ctx, &pb.StatsReq{})
if err != nil {
return err
}
log.Printf("Stats Summary : %v", reply)
return nil
}
// sign a message using the clients private key
func (client *Client) sign(msg []byte) (signature []byte, err error) {
if client.prikey == nil {

View File

@ -64,7 +64,7 @@ func Open(ctx context.Context, DataPath, DBPath string) (db *DB, err error) {
}
defer func() { _ = tx.Rollback() }()
_, err = tx.Exec("CREATE TABLE IF NOT EXISTS `ttl` (`id` BLOB UNIQUE, `created` INT(10), `expires` INT(10));")
_, err = tx.Exec("CREATE TABLE IF NOT EXISTS `ttl` (`id` BLOB UNIQUE, `created` INT(10), `expires` INT(10), `size` INT(10));")
if err != nil {
return nil, err
}
@ -74,6 +74,11 @@ func Open(ctx context.Context, DataPath, DBPath string) (db *DB, err error) {
return nil, err
}
_, err = tx.Exec("CREATE INDEX idx_ttl_expires ON ttl (expires);")
if err != nil {
return nil, err
}
err = tx.Commit()
if err != nil {
return nil, err
@ -205,6 +210,14 @@ func (db *DB) AddTTLToDB(id string, expiration int64) error {
return err
}
// UpdateTTLSize adds stored data size into database by id
func (db *DB) UpdateTTLSize(id string, size int64) error {
defer db.locked()()
_, err := db.DB.Exec("UPDATE ttl SET size=? WHERE id=?", size, id)
return err
}
// GetTTLByID finds the TTL in the database by id and return it
func (db *DB) GetTTLByID(id string) (expiration int64, err error) {
defer db.locked()()
@ -213,6 +226,14 @@ func (db *DB) GetTTLByID(id string) (expiration int64, err error) {
return expiration, err
}
// SumTTLSizes sums the size column on the ttl table
func (db *DB) SumTTLSizes() (sum int64, err error) {
defer db.locked()()
err = db.DB.QueryRow(`SELECT SUM(size) FROM ttl;`).Scan(&sum)
return sum, err
}
// DeleteTTLByID finds the TTL in the database by id and delete it
func (db *DB) DeleteTTLByID(id string) error {
defer db.locked()()

View File

@ -111,6 +111,18 @@ func (s *Server) Piece(ctx context.Context, in *pb.PieceId) (*pb.PieceSummary, e
return &pb.PieceSummary{Id: in.GetId(), Size: fileInfo.Size(), ExpirationUnixSec: ttl}, nil
}
// Stats will return statistics about the Server
func (s *Server) Stats(ctx context.Context, in *pb.StatsReq) (*pb.StatSummary, error) {
log.Printf("Getting Stats...\n")
totalUsed, err := s.DB.SumTTLSizes()
if err != nil {
return nil, err
}
return &pb.StatSummary{UsedSpace: totalUsed, AvailableSpace: 0}, nil
}
// Delete -- Delete data by Id from piecestore
func (s *Server) Delete(ctx context.Context, in *pb.PieceDelete) (*pb.PieceDeleteSummary, error) {
log.Printf("Deleting %s...", in.GetId())

View File

@ -54,6 +54,11 @@ func (s *Server) Store(reqStream pb.PieceStoreRoutes_StoreServer) (err error) {
return err
}
// If we put in the database first then that checks if the data already exists
if err = s.DB.UpdateTTLSize(pd.GetId(), total); err != nil {
return StoreError.New("Failed to write total data to ttl database")
}
log.Printf("Successfully stored %s.", pd.GetId())
return reqStream.SendAndClose(&pb.PieceStoreSummary{Message: OK, TotalReceived: total})

View File

@ -4,6 +4,8 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: storj.io/storj/pkg/piecestore/rpc/client (interfaces: PSClient)
// mockgen -destination=pkg/storage/ec/psclient_mock_test.go storj.io/storj/pkg/piecestore/rpc/client PSClient
// Package ecclient is a generated GoMock package.
package ecclient
@ -103,3 +105,15 @@ func (m *MockPSClient) Put(arg0 context.Context, arg1 client.PieceID, arg2 io.Re
func (mr *MockPSClientMockRecorder) Put(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockPSClient)(nil).Put), arg0, arg1, arg2, arg3, arg4)
}
// Stats mocks base method
func (m *MockPSClient) Stats(arg0 context.Context) error {
ret := m.ctrl.Call(m, "Stats", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// Stats indicates an expected call of Stats
func (mr *MockPSClientMockRecorder) Stats(arg0 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stats", reflect.TypeOf((*MockPSClient)(nil).Stats), arg0)
}

View File

@ -1,3 +1,6 @@
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: piece_store.proto
@ -35,7 +38,7 @@ func (m *PayerBandwidthAllocation) Reset() { *m = PayerBandwidthAllocati
func (m *PayerBandwidthAllocation) String() string { return proto.CompactTextString(m) }
func (*PayerBandwidthAllocation) ProtoMessage() {}
func (*PayerBandwidthAllocation) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{0}
return fileDescriptor_piece_store_c23e358761ca6810, []int{0}
}
func (m *PayerBandwidthAllocation) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PayerBandwidthAllocation.Unmarshal(m, b)
@ -84,7 +87,7 @@ func (m *PayerBandwidthAllocation_Data) Reset() { *m = PayerBandwidthAll
func (m *PayerBandwidthAllocation_Data) String() string { return proto.CompactTextString(m) }
func (*PayerBandwidthAllocation_Data) ProtoMessage() {}
func (*PayerBandwidthAllocation_Data) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{0, 0}
return fileDescriptor_piece_store_c23e358761ca6810, []int{0, 0}
}
func (m *PayerBandwidthAllocation_Data) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PayerBandwidthAllocation_Data.Unmarshal(m, b)
@ -151,7 +154,7 @@ func (m *RenterBandwidthAllocation) Reset() { *m = RenterBandwidthAlloca
func (m *RenterBandwidthAllocation) String() string { return proto.CompactTextString(m) }
func (*RenterBandwidthAllocation) ProtoMessage() {}
func (*RenterBandwidthAllocation) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{1}
return fileDescriptor_piece_store_c23e358761ca6810, []int{1}
}
func (m *RenterBandwidthAllocation) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RenterBandwidthAllocation.Unmarshal(m, b)
@ -197,7 +200,7 @@ func (m *RenterBandwidthAllocation_Data) Reset() { *m = RenterBandwidthA
func (m *RenterBandwidthAllocation_Data) String() string { return proto.CompactTextString(m) }
func (*RenterBandwidthAllocation_Data) ProtoMessage() {}
func (*RenterBandwidthAllocation_Data) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{1, 0}
return fileDescriptor_piece_store_c23e358761ca6810, []int{1, 0}
}
func (m *RenterBandwidthAllocation_Data) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RenterBandwidthAllocation_Data.Unmarshal(m, b)
@ -243,7 +246,7 @@ func (m *PieceStore) Reset() { *m = PieceStore{} }
func (m *PieceStore) String() string { return proto.CompactTextString(m) }
func (*PieceStore) ProtoMessage() {}
func (*PieceStore) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{2}
return fileDescriptor_piece_store_c23e358761ca6810, []int{2}
}
func (m *PieceStore) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceStore.Unmarshal(m, b)
@ -290,7 +293,7 @@ func (m *PieceStore_PieceData) Reset() { *m = PieceStore_PieceData{} }
func (m *PieceStore_PieceData) String() string { return proto.CompactTextString(m) }
func (*PieceStore_PieceData) ProtoMessage() {}
func (*PieceStore_PieceData) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{2, 0}
return fileDescriptor_piece_store_c23e358761ca6810, []int{2, 0}
}
func (m *PieceStore_PieceData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceStore_PieceData.Unmarshal(m, b)
@ -342,7 +345,7 @@ func (m *PieceId) Reset() { *m = PieceId{} }
func (m *PieceId) String() string { return proto.CompactTextString(m) }
func (*PieceId) ProtoMessage() {}
func (*PieceId) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{3}
return fileDescriptor_piece_store_c23e358761ca6810, []int{3}
}
func (m *PieceId) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceId.Unmarshal(m, b)
@ -382,7 +385,7 @@ func (m *PieceSummary) Reset() { *m = PieceSummary{} }
func (m *PieceSummary) String() string { return proto.CompactTextString(m) }
func (*PieceSummary) ProtoMessage() {}
func (*PieceSummary) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{4}
return fileDescriptor_piece_store_c23e358761ca6810, []int{4}
}
func (m *PieceSummary) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceSummary.Unmarshal(m, b)
@ -435,7 +438,7 @@ func (m *PieceRetrieval) Reset() { *m = PieceRetrieval{} }
func (m *PieceRetrieval) String() string { return proto.CompactTextString(m) }
func (*PieceRetrieval) ProtoMessage() {}
func (*PieceRetrieval) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{5}
return fileDescriptor_piece_store_c23e358761ca6810, []int{5}
}
func (m *PieceRetrieval) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceRetrieval.Unmarshal(m, b)
@ -482,7 +485,7 @@ func (m *PieceRetrieval_PieceData) Reset() { *m = PieceRetrieval_PieceDa
func (m *PieceRetrieval_PieceData) String() string { return proto.CompactTextString(m) }
func (*PieceRetrieval_PieceData) ProtoMessage() {}
func (*PieceRetrieval_PieceData) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{5, 0}
return fileDescriptor_piece_store_c23e358761ca6810, []int{5, 0}
}
func (m *PieceRetrieval_PieceData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceRetrieval_PieceData.Unmarshal(m, b)
@ -535,7 +538,7 @@ func (m *PieceRetrievalStream) Reset() { *m = PieceRetrievalStream{} }
func (m *PieceRetrievalStream) String() string { return proto.CompactTextString(m) }
func (*PieceRetrievalStream) ProtoMessage() {}
func (*PieceRetrievalStream) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{6}
return fileDescriptor_piece_store_c23e358761ca6810, []int{6}
}
func (m *PieceRetrievalStream) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceRetrievalStream.Unmarshal(m, b)
@ -580,7 +583,7 @@ func (m *PieceDelete) Reset() { *m = PieceDelete{} }
func (m *PieceDelete) String() string { return proto.CompactTextString(m) }
func (*PieceDelete) ProtoMessage() {}
func (*PieceDelete) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{7}
return fileDescriptor_piece_store_c23e358761ca6810, []int{7}
}
func (m *PieceDelete) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceDelete.Unmarshal(m, b)
@ -618,7 +621,7 @@ func (m *PieceDeleteSummary) Reset() { *m = PieceDeleteSummary{} }
func (m *PieceDeleteSummary) String() string { return proto.CompactTextString(m) }
func (*PieceDeleteSummary) ProtoMessage() {}
func (*PieceDeleteSummary) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{8}
return fileDescriptor_piece_store_c23e358761ca6810, []int{8}
}
func (m *PieceDeleteSummary) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceDeleteSummary.Unmarshal(m, b)
@ -657,7 +660,7 @@ func (m *PieceStoreSummary) Reset() { *m = PieceStoreSummary{} }
func (m *PieceStoreSummary) String() string { return proto.CompactTextString(m) }
func (*PieceStoreSummary) ProtoMessage() {}
func (*PieceStoreSummary) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_888c7042fdc2576a, []int{9}
return fileDescriptor_piece_store_c23e358761ca6810, []int{9}
}
func (m *PieceStoreSummary) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceStoreSummary.Unmarshal(m, b)
@ -691,6 +694,82 @@ func (m *PieceStoreSummary) GetTotalReceived() int64 {
return 0
}
type StatsReq struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *StatsReq) Reset() { *m = StatsReq{} }
func (m *StatsReq) String() string { return proto.CompactTextString(m) }
func (*StatsReq) ProtoMessage() {}
func (*StatsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_c23e358761ca6810, []int{10}
}
func (m *StatsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StatsReq.Unmarshal(m, b)
}
func (m *StatsReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StatsReq.Marshal(b, m, deterministic)
}
func (dst *StatsReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_StatsReq.Merge(dst, src)
}
func (m *StatsReq) XXX_Size() int {
return xxx_messageInfo_StatsReq.Size(m)
}
func (m *StatsReq) XXX_DiscardUnknown() {
xxx_messageInfo_StatsReq.DiscardUnknown(m)
}
var xxx_messageInfo_StatsReq proto.InternalMessageInfo
type StatSummary struct {
UsedSpace int64 `protobuf:"varint,1,opt,name=usedSpace,proto3" json:"usedSpace,omitempty"`
AvailableSpace int64 `protobuf:"varint,2,opt,name=availableSpace,proto3" json:"availableSpace,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *StatSummary) Reset() { *m = StatSummary{} }
func (m *StatSummary) String() string { return proto.CompactTextString(m) }
func (*StatSummary) ProtoMessage() {}
func (*StatSummary) Descriptor() ([]byte, []int) {
return fileDescriptor_piece_store_c23e358761ca6810, []int{11}
}
func (m *StatSummary) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StatSummary.Unmarshal(m, b)
}
func (m *StatSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StatSummary.Marshal(b, m, deterministic)
}
func (dst *StatSummary) XXX_Merge(src proto.Message) {
xxx_messageInfo_StatSummary.Merge(dst, src)
}
func (m *StatSummary) XXX_Size() int {
return xxx_messageInfo_StatSummary.Size(m)
}
func (m *StatSummary) XXX_DiscardUnknown() {
xxx_messageInfo_StatSummary.DiscardUnknown(m)
}
var xxx_messageInfo_StatSummary proto.InternalMessageInfo
func (m *StatSummary) GetUsedSpace() int64 {
if m != nil {
return m.UsedSpace
}
return 0
}
func (m *StatSummary) GetAvailableSpace() int64 {
if m != nil {
return m.AvailableSpace
}
return 0
}
func init() {
proto.RegisterType((*PayerBandwidthAllocation)(nil), "piecestoreroutes.PayerBandwidthAllocation")
proto.RegisterType((*PayerBandwidthAllocation_Data)(nil), "piecestoreroutes.PayerBandwidthAllocation.Data")
@ -706,6 +785,8 @@ func init() {
proto.RegisterType((*PieceDelete)(nil), "piecestoreroutes.PieceDelete")
proto.RegisterType((*PieceDeleteSummary)(nil), "piecestoreroutes.PieceDeleteSummary")
proto.RegisterType((*PieceStoreSummary)(nil), "piecestoreroutes.PieceStoreSummary")
proto.RegisterType((*StatsReq)(nil), "piecestoreroutes.StatsReq")
proto.RegisterType((*StatSummary)(nil), "piecestoreroutes.StatSummary")
}
// Reference imports to suppress errors if they are not otherwise used.
@ -724,6 +805,7 @@ type PieceStoreRoutesClient interface {
Retrieve(ctx context.Context, opts ...grpc.CallOption) (PieceStoreRoutes_RetrieveClient, error)
Store(ctx context.Context, opts ...grpc.CallOption) (PieceStoreRoutes_StoreClient, error)
Delete(ctx context.Context, in *PieceDelete, opts ...grpc.CallOption) (*PieceDeleteSummary, error)
Stats(ctx context.Context, in *StatsReq, opts ...grpc.CallOption) (*StatSummary, error)
}
type pieceStoreRoutesClient struct {
@ -817,12 +899,22 @@ func (c *pieceStoreRoutesClient) Delete(ctx context.Context, in *PieceDelete, op
return out, nil
}
func (c *pieceStoreRoutesClient) Stats(ctx context.Context, in *StatsReq, opts ...grpc.CallOption) (*StatSummary, error) {
out := new(StatSummary)
err := c.cc.Invoke(ctx, "/piecestoreroutes.PieceStoreRoutes/Stats", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PieceStoreRoutesServer is the server API for PieceStoreRoutes service.
type PieceStoreRoutesServer interface {
Piece(context.Context, *PieceId) (*PieceSummary, error)
Retrieve(PieceStoreRoutes_RetrieveServer) error
Store(PieceStoreRoutes_StoreServer) error
Delete(context.Context, *PieceDelete) (*PieceDeleteSummary, error)
Stats(context.Context, *StatsReq) (*StatSummary, error)
}
func RegisterPieceStoreRoutesServer(s *grpc.Server, srv PieceStoreRoutesServer) {
@ -917,6 +1009,24 @@ func _PieceStoreRoutes_Delete_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _PieceStoreRoutes_Stats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatsReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PieceStoreRoutesServer).Stats(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/piecestoreroutes.PieceStoreRoutes/Stats",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PieceStoreRoutesServer).Stats(ctx, req.(*StatsReq))
}
return interceptor(ctx, in, info, handler)
}
var _PieceStoreRoutes_serviceDesc = grpc.ServiceDesc{
ServiceName: "piecestoreroutes.PieceStoreRoutes",
HandlerType: (*PieceStoreRoutesServer)(nil),
@ -929,6 +1039,10 @@ var _PieceStoreRoutes_serviceDesc = grpc.ServiceDesc{
MethodName: "Delete",
Handler: _PieceStoreRoutes_Delete_Handler,
},
{
MethodName: "Stats",
Handler: _PieceStoreRoutes_Stats_Handler,
},
},
Streams: []grpc.StreamDesc{
{
@ -946,47 +1060,51 @@ var _PieceStoreRoutes_serviceDesc = grpc.ServiceDesc{
Metadata: "piece_store.proto",
}
func init() { proto.RegisterFile("piece_store.proto", fileDescriptor_piece_store_888c7042fdc2576a) }
func init() { proto.RegisterFile("piece_store.proto", fileDescriptor_piece_store_c23e358761ca6810) }
var fileDescriptor_piece_store_888c7042fdc2576a = []byte{
// 620 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xdd, 0x4e, 0xdb, 0x4c,
0x10, 0xc5, 0xce, 0x1f, 0x19, 0x02, 0x1f, 0x2c, 0x08, 0x39, 0x16, 0x7c, 0x8a, 0x0c, 0x42, 0x11,
0x95, 0xa2, 0x8a, 0x3e, 0x41, 0xab, 0x48, 0x2d, 0x37, 0x14, 0x6d, 0xc4, 0x4d, 0xa5, 0xca, 0xda,
0xd8, 0x03, 0x5d, 0xc9, 0x3f, 0xd1, 0x7a, 0x43, 0x03, 0x97, 0x7d, 0x8a, 0x3e, 0x40, 0x9f, 0xa4,
0xef, 0xd0, 0x27, 0xe9, 0x0b, 0x54, 0x19, 0x3b, 0x76, 0x42, 0xe2, 0xe4, 0xa6, 0xbd, 0xdb, 0x99,
0xd9, 0x3d, 0xe7, 0xcc, 0x9c, 0x5d, 0x1b, 0x0e, 0x46, 0x12, 0x3d, 0x74, 0x13, 0x1d, 0x2b, 0xec,
0x8d, 0x54, 0xac, 0x63, 0xb6, 0x4f, 0x29, 0xca, 0xa8,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30, 0x40, 0x8d,
0x4b, 0x6e, 0xf6, 0x80, 0xcd, 0x95, 0x67, 0x9e, 0x5a, 0xd0, 0x08, 0x31, 0x49, 0xc4, 0x03, 0x66,
0x5b, 0x67, 0xa1, 0x33, 0x80, 0x83, 0xe2, 0x8a, 0x6e, 0xdc, 0xce, 0xce, 0x61, 0x97, 0xde, 0x1a,
0x47, 0x0f, 0xe5, 0x23, 0xfa, 0x59, 0xe3, 0x8b, 0xc9, 0xab, 0x5f, 0x26, 0xec, 0x17, 0xa8, 0x9c,
0x66, 0xcd, 0xfa, 0x50, 0xa3, 0x1c, 0x6b, 0x97, 0xf8, 0x70, 0xed, 0xdb, 0xff, 0x97, 0x3d, 0xa0,
0x54, 0x98, 0xb3, 0xc5, 0x3e, 0xc1, 0x76, 0x36, 0x3f, 0x64, 0x9d, 0x4d, 0x86, 0xda, 0x17, 0x9b,
0x76, 0xa4, 0x16, 0x38, 0x5b, 0x5d, 0xe3, 0xb5, 0xc1, 0x6e, 0xa0, 0x96, 0x7e, 0x39, 0x4e, 0xd6,
0xbd, 0x63, 0xfb, 0x6c, 0x5d, 0x35, 0x57, 0xda, 0x35, 0xd8, 0x47, 0xa8, 0x67, 0x2e, 0x9d, 0x96,
0x1c, 0x49, 0xcb, 0xf6, 0xf9, 0xda, 0x72, 0x0e, 0x39, 0xac, 0xd3, 0x4f, 0xeb, 0xcd, 0x9f, 0x00,
0x00, 0x00, 0xff, 0xff, 0x32, 0xbf, 0x88, 0x7d, 0xc9, 0x06, 0x00, 0x00,
var fileDescriptor_piece_store_c23e358761ca6810 = []byte{
// 676 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xdb, 0x4e, 0xdb, 0x40,
0x10, 0xc5, 0xce, 0x8d, 0x4c, 0x02, 0x85, 0x05, 0x21, 0xc7, 0x82, 0x2a, 0x32, 0x08, 0x45, 0x54,
0x8a, 0x2a, 0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, 0xcc, 0x0c,
0x42, 0xd2, 0x7f, 0x6e, 0x63, 0xec, 0xd3, 0xe7, 0x6e, 0x68, 0x8f, 0x9d, 0x8d, 0x81, 0xf1, 0xda,
0x20, 0x97, 0xd0, 0xd0, 0x9f, 0xa6, 0xc3, 0x75, 0x1f, 0x0a, 0xfb, 0x78, 0x5d, 0xb6, 0x50, 0x3a,
0x30, 0xc8, 0x47, 0x68, 0x66, 0x6b, 0x70, 0x54, 0xf1, 0x44, 0xa7, 0xed, 0x93, 0xb5, 0xe9, 0xb2,
0xf9, 0x51, 0x2a, 0x90, 0x49, 0x41, 0xec, 0xe5, 0x07, 0xb9, 0xa3, 0xf6, 0xd1, 0xea, 0x5c, 0xc1,
0x32, 0x69, 0xaa, 0xff, 0xd6, 0x37, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x0c, 0xa2, 0x5f,
0x70, 0x07, 0x00, 0x00,
}

View File

@ -1,3 +1,6 @@
// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
// Code generated by MockGen. DO NOT EDIT.
// Source: storj.io/storj/protos/piecestore (interfaces: PieceStoreRoutesClient,PieceStoreRoutes_RetrieveClient)
@ -90,6 +93,24 @@ func (mr *MockPieceStoreRoutesClientMockRecorder) Retrieve(arg0 interface{}, arg
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retrieve", reflect.TypeOf((*MockPieceStoreRoutesClient)(nil).Retrieve), varargs...)
}
// Stats mocks base method
func (m *MockPieceStoreRoutesClient) Stats(arg0 context.Context, arg1 *StatsReq, arg2 ...grpc.CallOption) (*StatSummary, error) {
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Stats", varargs...)
ret0, _ := ret[0].(*StatSummary)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Stats indicates an expected call of Stats
func (mr *MockPieceStoreRoutesClientMockRecorder) Stats(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stats", reflect.TypeOf((*MockPieceStoreRoutesClient)(nil).Stats), varargs...)
}
// Store mocks base method
func (m *MockPieceStoreRoutesClient) Store(arg0 context.Context, arg1 ...grpc.CallOption) (PieceStoreRoutes_StoreClient, error) {
varargs := []interface{}{arg0}

View File

@ -14,6 +14,7 @@ service PieceStoreRoutes {
rpc Delete(PieceDelete) returns (PieceDeleteSummary) {}
rpc Stats(StatsReq) returns (StatSummary) {}
}
message PayerBandwidthAllocation {
@ -87,3 +88,10 @@ message PieceStoreSummary {
string message = 1;
int64 totalReceived = 2;
}
message StatsReq {}
message StatSummary {
int64 usedSpace = 1;
int64 availableSpace = 2;
}