diff --git a/go.mod b/go.mod index 327d42b4f..2cabc83b9 100644 --- a/go.mod +++ b/go.mod @@ -41,6 +41,7 @@ require ( golang.org/x/sys v0.0.0-20200929083018-4d22bbb62b3c golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e google.golang.org/api v0.20.0 // indirect + google.golang.org/protobuf v1.25.0 // indirect storj.io/common v0.0.0-20201207172416-78f4e59925c3 storj.io/drpc v0.0.16 storj.io/monkit-jaeger v0.0.0-20200518165323-80778fc3f91b diff --git a/go.sum b/go.sum index 1a80f8766..25d9827d0 100644 --- a/go.sum +++ b/go.sum @@ -169,6 +169,13 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -176,7 +183,9 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= @@ -720,6 +729,8 @@ google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBr google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba h1:pRj9OXZbwNtbtZtOB4dLwfK4u+EVRMvP+e9zKkg2grM= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -730,6 +741,15 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= diff --git a/multinodepb/diskspace.pb.go b/multinodepb/diskspace.pb.go new file mode 100644 index 000000000..9b39fd827 --- /dev/null +++ b/multinodepb/diskspace.pb.go @@ -0,0 +1,579 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: diskspace.proto + +package multinodepb + +import ( + context "context" + fmt "fmt" + math "math" + time "time" + + proto "github.com/gogo/protobuf/proto" + + drpc "storj.io/drpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type GetDiskSpaceRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetDiskSpaceRequest) Reset() { *m = GetDiskSpaceRequest{} } +func (m *GetDiskSpaceRequest) String() string { return proto.CompactTextString(m) } +func (*GetDiskSpaceRequest) ProtoMessage() {} +func (*GetDiskSpaceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9d1904cedee84a32, []int{0} +} +func (m *GetDiskSpaceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetDiskSpaceRequest.Unmarshal(m, b) +} +func (m *GetDiskSpaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetDiskSpaceRequest.Marshal(b, m, deterministic) +} +func (m *GetDiskSpaceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetDiskSpaceRequest.Merge(m, src) +} +func (m *GetDiskSpaceRequest) XXX_Size() int { + return xxx_messageInfo_GetDiskSpaceRequest.Size(m) +} +func (m *GetDiskSpaceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetDiskSpaceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetDiskSpaceRequest proto.InternalMessageInfo + +type GetDiskSpaceResponse struct { + DiskSpace *DiskSpace `protobuf:"bytes,1,opt,name=disk_space,json=diskSpace,proto3" json:"disk_space,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetDiskSpaceResponse) Reset() { *m = GetDiskSpaceResponse{} } +func (m *GetDiskSpaceResponse) String() string { return proto.CompactTextString(m) } +func (*GetDiskSpaceResponse) ProtoMessage() {} +func (*GetDiskSpaceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9d1904cedee84a32, []int{1} +} +func (m *GetDiskSpaceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetDiskSpaceResponse.Unmarshal(m, b) +} +func (m *GetDiskSpaceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetDiskSpaceResponse.Marshal(b, m, deterministic) +} +func (m *GetDiskSpaceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetDiskSpaceResponse.Merge(m, src) +} +func (m *GetDiskSpaceResponse) XXX_Size() int { + return xxx_messageInfo_GetDiskSpaceResponse.Size(m) +} +func (m *GetDiskSpaceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetDiskSpaceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetDiskSpaceResponse proto.InternalMessageInfo + +func (m *GetDiskSpaceResponse) GetDiskSpace() *DiskSpace { + if m != nil { + return m.DiskSpace + } + return nil +} + +// DiskSpace stores all info about storagenode disk space. +type DiskSpace struct { + Used int64 `protobuf:"varint,1,opt,name=used,proto3" json:"used,omitempty"` + Available int64 `protobuf:"varint,2,opt,name=available,proto3" json:"available,omitempty"` + Trash int64 `protobuf:"varint,3,opt,name=trash,proto3" json:"trash,omitempty"` + Overused int64 `protobuf:"varint,4,opt,name=overused,proto3" json:"overused,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DiskSpace) Reset() { *m = DiskSpace{} } +func (m *DiskSpace) String() string { return proto.CompactTextString(m) } +func (*DiskSpace) ProtoMessage() {} +func (*DiskSpace) Descriptor() ([]byte, []int) { + return fileDescriptor_9d1904cedee84a32, []int{2} +} +func (m *DiskSpace) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DiskSpace.Unmarshal(m, b) +} +func (m *DiskSpace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DiskSpace.Marshal(b, m, deterministic) +} +func (m *DiskSpace) XXX_Merge(src proto.Message) { + xxx_messageInfo_DiskSpace.Merge(m, src) +} +func (m *DiskSpace) XXX_Size() int { + return xxx_messageInfo_DiskSpace.Size(m) +} +func (m *DiskSpace) XXX_DiscardUnknown() { + xxx_messageInfo_DiskSpace.DiscardUnknown(m) +} + +var xxx_messageInfo_DiskSpace proto.InternalMessageInfo + +func (m *DiskSpace) GetUsed() int64 { + if m != nil { + return m.Used + } + return 0 +} + +func (m *DiskSpace) GetAvailable() int64 { + if m != nil { + return m.Available + } + return 0 +} + +func (m *DiskSpace) GetTrash() int64 { + if m != nil { + return m.Trash + } + return 0 +} + +func (m *DiskSpace) GetOverused() int64 { + if m != nil { + return m.Overused + } + return 0 +} + +type DailyStorageUsageRequest struct { + From time.Time `protobuf:"bytes,1,opt,name=from,proto3,stdtime" json:"from"` + To time.Time `protobuf:"bytes,2,opt,name=to,proto3,stdtime" json:"to"` + SatelliteId NodeID `protobuf:"bytes,3,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DailyStorageUsageRequest) Reset() { *m = DailyStorageUsageRequest{} } +func (m *DailyStorageUsageRequest) String() string { return proto.CompactTextString(m) } +func (*DailyStorageUsageRequest) ProtoMessage() {} +func (*DailyStorageUsageRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9d1904cedee84a32, []int{3} +} +func (m *DailyStorageUsageRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DailyStorageUsageRequest.Unmarshal(m, b) +} +func (m *DailyStorageUsageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DailyStorageUsageRequest.Marshal(b, m, deterministic) +} +func (m *DailyStorageUsageRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DailyStorageUsageRequest.Merge(m, src) +} +func (m *DailyStorageUsageRequest) XXX_Size() int { + return xxx_messageInfo_DailyStorageUsageRequest.Size(m) +} +func (m *DailyStorageUsageRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DailyStorageUsageRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DailyStorageUsageRequest proto.InternalMessageInfo + +func (m *DailyStorageUsageRequest) GetFrom() time.Time { + if m != nil { + return m.From + } + return time.Time{} +} + +func (m *DailyStorageUsageRequest) GetTo() time.Time { + if m != nil { + return m.To + } + return time.Time{} +} + +type DailyStorageUsageResponse struct { + NodeId []byte `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + DailyStorageUsage []*DailyStorageUsageResponse_StorageUsage `protobuf:"bytes,2,rep,name=daily_storage_usage,json=dailyStorageUsage,proto3" json:"daily_storage_usage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DailyStorageUsageResponse) Reset() { *m = DailyStorageUsageResponse{} } +func (m *DailyStorageUsageResponse) String() string { return proto.CompactTextString(m) } +func (*DailyStorageUsageResponse) ProtoMessage() {} +func (*DailyStorageUsageResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9d1904cedee84a32, []int{4} +} +func (m *DailyStorageUsageResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DailyStorageUsageResponse.Unmarshal(m, b) +} +func (m *DailyStorageUsageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DailyStorageUsageResponse.Marshal(b, m, deterministic) +} +func (m *DailyStorageUsageResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DailyStorageUsageResponse.Merge(m, src) +} +func (m *DailyStorageUsageResponse) XXX_Size() int { + return xxx_messageInfo_DailyStorageUsageResponse.Size(m) +} +func (m *DailyStorageUsageResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DailyStorageUsageResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DailyStorageUsageResponse proto.InternalMessageInfo + +func (m *DailyStorageUsageResponse) GetNodeId() []byte { + if m != nil { + return m.NodeId + } + return nil +} + +func (m *DailyStorageUsageResponse) GetDailyStorageUsage() []*DailyStorageUsageResponse_StorageUsage { + if m != nil { + return m.DailyStorageUsage + } + return nil +} + +type DailyStorageUsageResponse_StorageUsage struct { + AtRestTotal float64 `protobuf:"fixed64,1,opt,name=at_rest_total,json=atRestTotal,proto3" json:"at_rest_total,omitempty"` + Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DailyStorageUsageResponse_StorageUsage) Reset() { + *m = DailyStorageUsageResponse_StorageUsage{} +} +func (m *DailyStorageUsageResponse_StorageUsage) String() string { return proto.CompactTextString(m) } +func (*DailyStorageUsageResponse_StorageUsage) ProtoMessage() {} +func (*DailyStorageUsageResponse_StorageUsage) Descriptor() ([]byte, []int) { + return fileDescriptor_9d1904cedee84a32, []int{4, 0} +} +func (m *DailyStorageUsageResponse_StorageUsage) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.Unmarshal(m, b) +} +func (m *DailyStorageUsageResponse_StorageUsage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.Marshal(b, m, deterministic) +} +func (m *DailyStorageUsageResponse_StorageUsage) XXX_Merge(src proto.Message) { + xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.Merge(m, src) +} +func (m *DailyStorageUsageResponse_StorageUsage) XXX_Size() int { + return xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.Size(m) +} +func (m *DailyStorageUsageResponse_StorageUsage) XXX_DiscardUnknown() { + xxx_messageInfo_DailyStorageUsageResponse_StorageUsage.DiscardUnknown(m) +} + +var xxx_messageInfo_DailyStorageUsageResponse_StorageUsage proto.InternalMessageInfo + +func (m *DailyStorageUsageResponse_StorageUsage) GetAtRestTotal() float64 { + if m != nil { + return m.AtRestTotal + } + return 0 +} + +func (m *DailyStorageUsageResponse_StorageUsage) GetTimestamp() time.Time { + if m != nil { + return m.Timestamp + } + return time.Time{} +} + +type SatelliteSummaryRequest struct { + From time.Time `protobuf:"bytes,1,opt,name=from,proto3,stdtime" json:"from"` + To time.Time `protobuf:"bytes,2,opt,name=to,proto3,stdtime" json:"to"` + SatelliteId NodeID `protobuf:"bytes,3,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SatelliteSummaryRequest) Reset() { *m = SatelliteSummaryRequest{} } +func (m *SatelliteSummaryRequest) String() string { return proto.CompactTextString(m) } +func (*SatelliteSummaryRequest) ProtoMessage() {} +func (*SatelliteSummaryRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9d1904cedee84a32, []int{5} +} +func (m *SatelliteSummaryRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SatelliteSummaryRequest.Unmarshal(m, b) +} +func (m *SatelliteSummaryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SatelliteSummaryRequest.Marshal(b, m, deterministic) +} +func (m *SatelliteSummaryRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SatelliteSummaryRequest.Merge(m, src) +} +func (m *SatelliteSummaryRequest) XXX_Size() int { + return xxx_messageInfo_SatelliteSummaryRequest.Size(m) +} +func (m *SatelliteSummaryRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SatelliteSummaryRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SatelliteSummaryRequest proto.InternalMessageInfo + +func (m *SatelliteSummaryRequest) GetFrom() time.Time { + if m != nil { + return m.From + } + return time.Time{} +} + +func (m *SatelliteSummaryRequest) GetTo() time.Time { + if m != nil { + return m.To + } + return time.Time{} +} + +type SatelliteSummaryResponse struct { + StorageUsage float64 `protobuf:"fixed64,1,opt,name=storage_usage,json=storageUsage,proto3" json:"storage_usage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SatelliteSummaryResponse) Reset() { *m = SatelliteSummaryResponse{} } +func (m *SatelliteSummaryResponse) String() string { return proto.CompactTextString(m) } +func (*SatelliteSummaryResponse) ProtoMessage() {} +func (*SatelliteSummaryResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9d1904cedee84a32, []int{6} +} +func (m *SatelliteSummaryResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SatelliteSummaryResponse.Unmarshal(m, b) +} +func (m *SatelliteSummaryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SatelliteSummaryResponse.Marshal(b, m, deterministic) +} +func (m *SatelliteSummaryResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SatelliteSummaryResponse.Merge(m, src) +} +func (m *SatelliteSummaryResponse) XXX_Size() int { + return xxx_messageInfo_SatelliteSummaryResponse.Size(m) +} +func (m *SatelliteSummaryResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SatelliteSummaryResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SatelliteSummaryResponse proto.InternalMessageInfo + +func (m *SatelliteSummaryResponse) GetStorageUsage() float64 { + if m != nil { + return m.StorageUsage + } + return 0 +} + +func init() { + proto.RegisterType((*GetDiskSpaceRequest)(nil), "diskspace.GetDiskSpaceRequest") + proto.RegisterType((*GetDiskSpaceResponse)(nil), "diskspace.GetDiskSpaceResponse") + proto.RegisterType((*DiskSpace)(nil), "diskspace.DiskSpace") + proto.RegisterType((*DailyStorageUsageRequest)(nil), "diskspace.DailyStorageUsageRequest") + proto.RegisterType((*DailyStorageUsageResponse)(nil), "diskspace.DailyStorageUsageResponse") + proto.RegisterType((*DailyStorageUsageResponse_StorageUsage)(nil), "diskspace.DailyStorageUsageResponse.StorageUsage") + proto.RegisterType((*SatelliteSummaryRequest)(nil), "diskspace.SatelliteSummaryRequest") + proto.RegisterType((*SatelliteSummaryResponse)(nil), "diskspace.SatelliteSummaryResponse") +} + +func init() { proto.RegisterFile("diskspace.proto", fileDescriptor_9d1904cedee84a32) } + +var fileDescriptor_9d1904cedee84a32 = []byte{ + // 528 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x53, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0xc5, 0x4e, 0x08, 0xcd, 0xc4, 0x01, 0xba, 0x0d, 0xaa, 0xb1, 0x2a, 0x52, 0x39, 0x1c, 0x7a, + 0x72, 0xd4, 0x94, 0x03, 0x37, 0xa4, 0x28, 0x12, 0x8a, 0x90, 0x40, 0x72, 0xca, 0x05, 0x24, 0xac, + 0x0d, 0xde, 0x9a, 0xa5, 0x76, 0xd7, 0x78, 0xc7, 0x91, 0xfa, 0x15, 0xf0, 0x03, 0xfc, 0x09, 0xdc, + 0xf9, 0x06, 0x0e, 0xe5, 0x57, 0xd0, 0xae, 0x13, 0xdb, 0x69, 0x9b, 0xaa, 0x1c, 0xb9, 0xed, 0xcc, + 0xce, 0x9b, 0x7d, 0xfb, 0xde, 0x0c, 0x3c, 0x08, 0xb9, 0x3c, 0x95, 0x29, 0xfd, 0xc8, 0xbc, 0x34, + 0x13, 0x28, 0x48, 0xbb, 0x4c, 0x38, 0x10, 0x89, 0x48, 0x14, 0x69, 0xa7, 0x1f, 0x09, 0x11, 0xc5, + 0x6c, 0xa8, 0xa3, 0x79, 0x7e, 0x32, 0x44, 0x9e, 0x30, 0x89, 0x34, 0x49, 0x8b, 0x02, 0xf7, 0x11, + 0xec, 0xbc, 0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, + 0x7d, 0xf6, 0xb8, 0x18, 0xea, 0xc3, 0x30, 0xc9, 0x63, 0xe4, 0x6a, 0x31, 0xd2, 0xf9, 0xbc, 0xa5, + 0x3d, 0x3d, 0xfa, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xb3, 0xd3, 0x33, 0x3c, 0x36, 0x05, 0x00, 0x00, +} + +// --- DRPC BEGIN --- + +type DRPCNodeDiskSpaceClient interface { + DRPCConn() drpc.Conn + + GetDiskSpace(ctx context.Context, in *GetDiskSpaceRequest) (*GetDiskSpaceResponse, error) + DailyStorageUsage(ctx context.Context, in *DailyStorageUsageRequest) (*DailyStorageUsageResponse, error) + SatelliteSummary(ctx context.Context, in *SatelliteSummaryRequest) (*SatelliteSummaryResponse, error) +} + +type drpcNodeDiskSpaceClient struct { + cc drpc.Conn +} + +func NewDRPCNodeDiskSpaceClient(cc drpc.Conn) DRPCNodeDiskSpaceClient { + return &drpcNodeDiskSpaceClient{cc} +} + +func (c *drpcNodeDiskSpaceClient) DRPCConn() drpc.Conn { return c.cc } + +func (c *drpcNodeDiskSpaceClient) GetDiskSpace(ctx context.Context, in *GetDiskSpaceRequest) (*GetDiskSpaceResponse, error) { + out := new(GetDiskSpaceResponse) + err := c.cc.Invoke(ctx, "/diskspace.NodeDiskSpace/GetDiskSpace", in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcNodeDiskSpaceClient) DailyStorageUsage(ctx context.Context, in *DailyStorageUsageRequest) (*DailyStorageUsageResponse, error) { + out := new(DailyStorageUsageResponse) + err := c.cc.Invoke(ctx, "/diskspace.NodeDiskSpace/DailyStorageUsage", in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcNodeDiskSpaceClient) SatelliteSummary(ctx context.Context, in *SatelliteSummaryRequest) (*SatelliteSummaryResponse, error) { + out := new(SatelliteSummaryResponse) + err := c.cc.Invoke(ctx, "/diskspace.NodeDiskSpace/SatelliteSummary", in, out) + if err != nil { + return nil, err + } + return out, nil +} + +type DRPCNodeDiskSpaceServer interface { + GetDiskSpace(context.Context, *GetDiskSpaceRequest) (*GetDiskSpaceResponse, error) + DailyStorageUsage(context.Context, *DailyStorageUsageRequest) (*DailyStorageUsageResponse, error) + SatelliteSummary(context.Context, *SatelliteSummaryRequest) (*SatelliteSummaryResponse, error) +} + +type DRPCNodeDiskSpaceDescription struct{} + +func (DRPCNodeDiskSpaceDescription) NumMethods() int { return 3 } + +func (DRPCNodeDiskSpaceDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { + switch n { + case 0: + return "/diskspace.NodeDiskSpace/GetDiskSpace", + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCNodeDiskSpaceServer). + GetDiskSpace( + ctx, + in1.(*GetDiskSpaceRequest), + ) + }, DRPCNodeDiskSpaceServer.GetDiskSpace, true + case 1: + return "/diskspace.NodeDiskSpace/DailyStorageUsage", + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCNodeDiskSpaceServer). + DailyStorageUsage( + ctx, + in1.(*DailyStorageUsageRequest), + ) + }, DRPCNodeDiskSpaceServer.DailyStorageUsage, true + case 2: + return "/diskspace.NodeDiskSpace/SatelliteSummary", + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCNodeDiskSpaceServer). + SatelliteSummary( + ctx, + in1.(*SatelliteSummaryRequest), + ) + }, DRPCNodeDiskSpaceServer.SatelliteSummary, true + default: + return "", nil, nil, false + } +} + +func DRPCRegisterNodeDiskSpace(mux drpc.Mux, impl DRPCNodeDiskSpaceServer) error { + return mux.Register(impl, DRPCNodeDiskSpaceDescription{}) +} + +type DRPCNodeDiskSpace_GetDiskSpaceStream interface { + drpc.Stream + SendAndClose(*GetDiskSpaceResponse) error +} + +type drpcNodeDiskSpaceGetDiskSpaceStream struct { + drpc.Stream +} + +func (x *drpcNodeDiskSpaceGetDiskSpaceStream) SendAndClose(m *GetDiskSpaceResponse) error { + if err := x.MsgSend(m); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCNodeDiskSpace_DailyStorageUsageStream interface { + drpc.Stream + SendAndClose(*DailyStorageUsageResponse) error +} + +type drpcNodeDiskSpaceDailyStorageUsageStream struct { + drpc.Stream +} + +func (x *drpcNodeDiskSpaceDailyStorageUsageStream) SendAndClose(m *DailyStorageUsageResponse) error { + if err := x.MsgSend(m); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCNodeDiskSpace_SatelliteSummaryStream interface { + drpc.Stream + SendAndClose(*SatelliteSummaryResponse) error +} + +type drpcNodeDiskSpaceSatelliteSummaryStream struct { + drpc.Stream +} + +func (x *drpcNodeDiskSpaceSatelliteSummaryStream) SendAndClose(m *SatelliteSummaryResponse) error { + if err := x.MsgSend(m); err != nil { + return err + } + return x.CloseSend() +} + +// --- DRPC END --- diff --git a/multinodepb/diskspace.proto b/multinodepb/diskspace.proto new file mode 100644 index 000000000..348f7f3ee --- /dev/null +++ b/multinodepb/diskspace.proto @@ -0,0 +1,56 @@ +// Copyright (C) 2020 Storj Labs, Inc. +// See LICENSE for copying information. + +syntax = "proto3"; +option go_package = "storj.io/storj/multinodepb"; + +package diskspace; + +import "gogo.proto"; +import "google/protobuf/timestamp.proto"; + +service NodeDiskSpace { + rpc GetDiskSpace(GetDiskSpaceRequest) returns (GetDiskSpaceResponse); + rpc DailyStorageUsage(DailyStorageUsageRequest) returns (DailyStorageUsageResponse); + rpc SatelliteSummary(SatelliteSummaryRequest) returns (SatelliteSummaryResponse); +} + +message GetDiskSpaceRequest {} + +message GetDiskSpaceResponse { + DiskSpace disk_space = 1; +} + +// DiskSpace stores all info about storagenode disk space. +message DiskSpace { + int64 used = 1; + int64 available = 2; + int64 trash = 3; + int64 overused = 4; +} + +message DailyStorageUsageRequest { + google.protobuf.Timestamp from = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Timestamp to = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + bytes satellite_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; +} + +message DailyStorageUsageResponse { + message StorageUsage { + double at_rest_total = 1; + google.protobuf.Timestamp timestamp = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + } + + bytes node_id = 1; + repeated StorageUsage daily_storage_usage = 2; +} + +message SatelliteSummaryRequest { + google.protobuf.Timestamp from = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Timestamp to = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + bytes satellite_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; +} + +message SatelliteSummaryResponse { + double storage_usage = 1; +} diff --git a/multinodepb/doc.go b/multinodepb/doc.go new file mode 100644 index 000000000..b61694fe5 --- /dev/null +++ b/multinodepb/doc.go @@ -0,0 +1,7 @@ +// Copyright (C) 2020 Storj Labs, Inc. +// See LICENSE for copying information. + +// Package multinodepb contains protobuf definitions for Storj peers. +package multinodepb + +//go:generate go run gen.go diff --git a/multinodepb/gen.go b/multinodepb/gen.go new file mode 100644 index 000000000..705ce7336 --- /dev/null +++ b/multinodepb/gen.go @@ -0,0 +1,116 @@ +// Copyright (C) 2019 Storj Labs, Inc. +// See LICENSE for copying information. + +// +build ignore + +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "strings" +) + +var ( + mainpkg = flag.String("pkg", "storj.io/storj/multinodepb", "main package name") + protoc = flag.String("protoc", "protoc", "protoc compiler") +) + +var ignoreProto = map[string]bool{ + "gogo.proto": true, +} + +func ignore(files []string) []string { + xs := []string{} + for _, file := range files { + if !ignoreProto[file] { + xs = append(xs, file) + } + } + return xs +} + +// Programs needed for code generation: +// +// github.com/ckaznocha/protoc-gen-lint +// storj.io/drpc/cmd/protoc-gen-drpc +// github.com/nilslice/protolock/cmd/protolock + +func main() { + flag.Parse() + + // TODO: protolock + + { + // cleanup previous files + localfiles, err := filepath.Glob("*.pb.go") + check(err) + + all := []string{} + all = append(all, localfiles...) + for _, match := range all { + _ = os.Remove(match) + } + } + + { + protofiles, err := filepath.Glob("*.proto") + check(err) + + protofiles = ignore(protofiles) + + overrideImports := ",Mgoogle/protobuf/timestamp.proto=storj.io/storj/multinodepb" + args := []string{ + "--lint_out=.", + "--drpc_out=plugins=drpc,paths=source_relative" + overrideImports + ":.", + "-I=.", + } + args = append(args, protofiles...) + + // generate new code + cmd := exec.Command(*protoc, args...) + fmt.Println(strings.Join(cmd.Args, " ")) + out, err := cmd.CombinedOutput() + fmt.Println(string(out)) + check(err) + } + + { + files, err := filepath.Glob("*.pb.go") + check(err) + for _, file := range files { + process(file) + } + } + + { + // format code to get rid of extra imports + out, err := exec.Command("goimports", "-local", "storj.io", "-w", ".").CombinedOutput() + fmt.Println(string(out)) + check(err) + } +} + +func process(file string) { + data, err := ioutil.ReadFile(file) + check(err) + + source := string(data) + + // When generating code to the same path as proto, it will + // end up generating an `import _ "."`, the following replace removes it. + source = strings.Replace(source, `_ "."`, "", -1) + + err = ioutil.WriteFile(file, []byte(source), 0644) + check(err) +} + +func check(err error) { + if err != nil { + panic(err) + } +} diff --git a/multinodepb/gogo.proto b/multinodepb/gogo.proto new file mode 100644 index 000000000..937487bf8 --- /dev/null +++ b/multinodepb/gogo.proto @@ -0,0 +1,143 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; +package gogoproto; + +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protobuf"; +option java_outer_classname = "GoGoProtos"; + +extend google.protobuf.EnumOptions { + optional bool goproto_enum_prefix = 62001; + optional bool goproto_enum_stringer = 62021; + optional bool enum_stringer = 62022; + optional string enum_customname = 62023; + optional bool enumdecl = 62024; +} + +extend google.protobuf.EnumValueOptions { + optional string enumvalue_customname = 66001; +} + +extend google.protobuf.FileOptions { + optional bool goproto_getters_all = 63001; + optional bool goproto_enum_prefix_all = 63002; + optional bool goproto_stringer_all = 63003; + optional bool verbose_equal_all = 63004; + optional bool face_all = 63005; + optional bool gostring_all = 63006; + optional bool populate_all = 63007; + optional bool stringer_all = 63008; + optional bool onlyone_all = 63009; + + optional bool equal_all = 63013; + optional bool description_all = 63014; + optional bool testgen_all = 63015; + optional bool benchgen_all = 63016; + optional bool marshaler_all = 63017; + optional bool unmarshaler_all = 63018; + optional bool stable_marshaler_all = 63019; + + optional bool sizer_all = 63020; + + optional bool goproto_enum_stringer_all = 63021; + optional bool enum_stringer_all = 63022; + + optional bool unsafe_marshaler_all = 63023; + optional bool unsafe_unmarshaler_all = 63024; + + optional bool goproto_extensions_map_all = 63025; + optional bool goproto_unrecognized_all = 63026; + optional bool gogoproto_import = 63027; + optional bool protosizer_all = 63028; + optional bool compare_all = 63029; + optional bool typedecl_all = 63030; + optional bool enumdecl_all = 63031; + + optional bool goproto_registration = 63032; + optional bool messagename_all = 63033; + + optional bool goproto_sizecache_all = 63034; + optional bool goproto_unkeyed_all = 63035; +} + +extend google.protobuf.MessageOptions { + optional bool goproto_getters = 64001; + optional bool goproto_stringer = 64003; + optional bool verbose_equal = 64004; + optional bool face = 64005; + optional bool gostring = 64006; + optional bool populate = 64007; + optional bool stringer = 67008; + optional bool onlyone = 64009; + + optional bool equal = 64013; + optional bool description = 64014; + optional bool testgen = 64015; + optional bool benchgen = 64016; + optional bool marshaler = 64017; + optional bool unmarshaler = 64018; + optional bool stable_marshaler = 64019; + + optional bool sizer = 64020; + + optional bool unsafe_marshaler = 64023; + optional bool unsafe_unmarshaler = 64024; + + optional bool goproto_extensions_map = 64025; + optional bool goproto_unrecognized = 64026; + + optional bool protosizer = 64028; + + optional bool typedecl = 64030; + + optional bool messagename = 64033; + + optional bool goproto_sizecache = 64034; + optional bool goproto_unkeyed = 64035; +} + +extend google.protobuf.FieldOptions { + optional bool nullable = 65001; + optional bool embed = 65002; + optional string customtype = 65003; + optional string customname = 65004; + optional string jsontag = 65005; + optional string moretags = 65006; + optional string casttype = 65007; + optional string castkey = 65008; + optional string castvalue = 65009; + + optional bool stdtime = 65010; + optional bool stdduration = 65011; + optional bool wktpointer = 65012; + optional bool compare = 65013; + +} \ No newline at end of file diff --git a/multinodepb/reputation.pb.go b/multinodepb/reputation.pb.go new file mode 100644 index 000000000..d7e0521f0 --- /dev/null +++ b/multinodepb/reputation.pb.go @@ -0,0 +1,466 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: reputation.proto + +package multinodepb + +import ( + context "context" + fmt "fmt" + math "math" + time "time" + + proto "github.com/gogo/protobuf/proto" + + drpc "storj.io/drpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type ReputationStats struct { + TotalCount int64 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` + SuccessCount int64 `protobuf:"varint,2,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"` + ReputationAlpha float64 `protobuf:"fixed64,3,opt,name=reputation_alpha,json=reputationAlpha,proto3" json:"reputation_alpha,omitempty"` + ReputationBeta float64 `protobuf:"fixed64,4,opt,name=reputation_beta,json=reputationBeta,proto3" json:"reputation_beta,omitempty"` + ReputationScore float64 `protobuf:"fixed64,5,opt,name=reputation_score,json=reputationScore,proto3" json:"reputation_score,omitempty"` + UnknownReputationAlpha float64 `protobuf:"fixed64,6,opt,name=unknown_reputation_alpha,json=unknownReputationAlpha,proto3" json:"unknown_reputation_alpha,omitempty"` + UnknownReputationBeta float64 `protobuf:"fixed64,7,opt,name=unknown_reputation_beta,json=unknownReputationBeta,proto3" json:"unknown_reputation_beta,omitempty"` + UnknownReputationScore float64 `protobuf:"fixed64,8,opt,name=unknown_reputation_score,json=unknownReputationScore,proto3" json:"unknown_reputation_score,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ReputationStats) Reset() { *m = ReputationStats{} } +func (m *ReputationStats) String() string { return proto.CompactTextString(m) } +func (*ReputationStats) ProtoMessage() {} +func (*ReputationStats) Descriptor() ([]byte, []int) { + return fileDescriptor_b35a2508345eddf0, []int{0} +} +func (m *ReputationStats) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReputationStats.Unmarshal(m, b) +} +func (m *ReputationStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReputationStats.Marshal(b, m, deterministic) +} +func (m *ReputationStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReputationStats.Merge(m, src) +} +func (m *ReputationStats) XXX_Size() int { + return xxx_messageInfo_ReputationStats.Size(m) +} +func (m *ReputationStats) XXX_DiscardUnknown() { + xxx_messageInfo_ReputationStats.DiscardUnknown(m) +} + +var xxx_messageInfo_ReputationStats proto.InternalMessageInfo + +func (m *ReputationStats) GetTotalCount() int64 { + if m != nil { + return m.TotalCount + } + return 0 +} + +func (m *ReputationStats) GetSuccessCount() int64 { + if m != nil { + return m.SuccessCount + } + return 0 +} + +func (m *ReputationStats) GetReputationAlpha() float64 { + if m != nil { + return m.ReputationAlpha + } + return 0 +} + +func (m *ReputationStats) GetReputationBeta() float64 { + if m != nil { + return m.ReputationBeta + } + return 0 +} + +func (m *ReputationStats) GetReputationScore() float64 { + if m != nil { + return m.ReputationScore + } + return 0 +} + +func (m *ReputationStats) GetUnknownReputationAlpha() float64 { + if m != nil { + return m.UnknownReputationAlpha + } + return 0 +} + +func (m *ReputationStats) GetUnknownReputationBeta() float64 { + if m != nil { + return m.UnknownReputationBeta + } + return 0 +} + +func (m *ReputationStats) GetUnknownReputationScore() float64 { + if m != nil { + return m.UnknownReputationScore + } + return 0 +} + +type GetBySatelliteIDRequest struct { + SatelliteId NodeID `protobuf:"bytes,1,opt,name=satellite_id,json=satelliteId,proto3,customtype=NodeID" json:"satellite_id"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetBySatelliteIDRequest) Reset() { *m = GetBySatelliteIDRequest{} } +func (m *GetBySatelliteIDRequest) String() string { return proto.CompactTextString(m) } +func (*GetBySatelliteIDRequest) ProtoMessage() {} +func (*GetBySatelliteIDRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b35a2508345eddf0, []int{1} +} +func (m *GetBySatelliteIDRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetBySatelliteIDRequest.Unmarshal(m, b) +} +func (m *GetBySatelliteIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetBySatelliteIDRequest.Marshal(b, m, deterministic) +} +func (m *GetBySatelliteIDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBySatelliteIDRequest.Merge(m, src) +} +func (m *GetBySatelliteIDRequest) XXX_Size() int { + return xxx_messageInfo_GetBySatelliteIDRequest.Size(m) +} +func (m *GetBySatelliteIDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetBySatelliteIDRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetBySatelliteIDRequest proto.InternalMessageInfo + +type GetBySatelliteIDResponse struct { + AuditCheck *ReputationStats `protobuf:"bytes,1,opt,name=audit_check,json=auditCheck,proto3" json:"audit_check,omitempty"` + Disqualified *time.Time `protobuf:"bytes,2,opt,name=disqualified,proto3,stdtime" json:"disqualified,omitempty"` + Suspended *time.Time `protobuf:"bytes,3,opt,name=suspended,proto3,stdtime" json:"suspended,omitempty"` + JoinedAt time.Time `protobuf:"bytes,4,opt,name=joined_at,json=joinedAt,proto3,stdtime" json:"joined_at"` + OfflineSuspended *time.Time `protobuf:"bytes,5,opt,name=offline_suspended,json=offlineSuspended,proto3,stdtime" json:"offline_suspended,omitempty"` + OnlineScore float64 `protobuf:"fixed64,6,opt,name=online_score,json=onlineScore,proto3" json:"online_score,omitempty"` + OfflineUnderReview *time.Time `protobuf:"bytes,7,opt,name=offline_under_review,json=offlineUnderReview,proto3,stdtime" json:"offline_under_review,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetBySatelliteIDResponse) Reset() { *m = GetBySatelliteIDResponse{} } +func (m *GetBySatelliteIDResponse) String() string { return proto.CompactTextString(m) } +func (*GetBySatelliteIDResponse) ProtoMessage() {} +func (*GetBySatelliteIDResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b35a2508345eddf0, []int{2} +} +func (m *GetBySatelliteIDResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetBySatelliteIDResponse.Unmarshal(m, b) +} +func (m *GetBySatelliteIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetBySatelliteIDResponse.Marshal(b, m, deterministic) +} +func (m *GetBySatelliteIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBySatelliteIDResponse.Merge(m, src) +} +func (m *GetBySatelliteIDResponse) XXX_Size() int { + return xxx_messageInfo_GetBySatelliteIDResponse.Size(m) +} +func (m *GetBySatelliteIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetBySatelliteIDResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetBySatelliteIDResponse proto.InternalMessageInfo + +func (m *GetBySatelliteIDResponse) GetAuditCheck() *ReputationStats { + if m != nil { + return m.AuditCheck + } + return nil +} + +func (m *GetBySatelliteIDResponse) GetDisqualified() *time.Time { + if m != nil { + return m.Disqualified + } + return nil +} + +func (m *GetBySatelliteIDResponse) GetSuspended() *time.Time { + if m != nil { + return m.Suspended + } + return nil +} + +func (m *GetBySatelliteIDResponse) GetJoinedAt() time.Time { + if m != nil { + return m.JoinedAt + } + return time.Time{} +} + +func (m *GetBySatelliteIDResponse) GetOfflineSuspended() *time.Time { + if m != nil { + return m.OfflineSuspended + } + return nil +} + +func (m *GetBySatelliteIDResponse) GetOnlineScore() float64 { + if m != nil { + return m.OnlineScore + } + return 0 +} + +func (m *GetBySatelliteIDResponse) GetOfflineUnderReview() *time.Time { + if m != nil { + return m.OfflineUnderReview + } + return nil +} + +type AllRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AllRequest) Reset() { *m = AllRequest{} } +func (m *AllRequest) String() string { return proto.CompactTextString(m) } +func (*AllRequest) ProtoMessage() {} +func (*AllRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b35a2508345eddf0, []int{3} +} +func (m *AllRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AllRequest.Unmarshal(m, b) +} +func (m *AllRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AllRequest.Marshal(b, m, deterministic) +} +func (m *AllRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllRequest.Merge(m, src) +} +func (m *AllRequest) XXX_Size() int { + return xxx_messageInfo_AllRequest.Size(m) +} +func (m *AllRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AllRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AllRequest proto.InternalMessageInfo + +type AllResponse struct { + Reputation []*GetBySatelliteIDResponse `protobuf:"bytes,1,rep,name=reputation,proto3" json:"reputation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AllResponse) Reset() { *m = AllResponse{} } +func (m *AllResponse) String() string { return proto.CompactTextString(m) } +func (*AllResponse) ProtoMessage() {} +func (*AllResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b35a2508345eddf0, []int{4} +} +func (m *AllResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AllResponse.Unmarshal(m, b) +} +func (m *AllResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AllResponse.Marshal(b, m, deterministic) +} +func (m *AllResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllResponse.Merge(m, src) +} +func (m *AllResponse) XXX_Size() int { + return xxx_messageInfo_AllResponse.Size(m) +} +func (m *AllResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AllResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AllResponse proto.InternalMessageInfo + +func (m *AllResponse) GetReputation() []*GetBySatelliteIDResponse { + if m != nil { + return m.Reputation + } + return nil +} + +func init() { + proto.RegisterType((*ReputationStats)(nil), "reputation.ReputationStats") + proto.RegisterType((*GetBySatelliteIDRequest)(nil), "reputation.GetBySatelliteIDRequest") + proto.RegisterType((*GetBySatelliteIDResponse)(nil), "reputation.GetBySatelliteIDResponse") + proto.RegisterType((*AllRequest)(nil), "reputation.AllRequest") + proto.RegisterType((*AllResponse)(nil), "reputation.AllResponse") +} + +func init() { proto.RegisterFile("reputation.proto", fileDescriptor_b35a2508345eddf0) } + +var fileDescriptor_b35a2508345eddf0 = []byte{ + // 584 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xc1, 0x6e, 0xd3, 0x40, + 0x14, 0xac, 0x31, 0x2d, 0xed, 0xb3, 0x69, 0xcb, 0x0a, 0x5a, 0xcb, 0x20, 0xb9, 0xa4, 0x48, 0x84, + 0x8b, 0x23, 0x82, 0x54, 0x71, 0xe0, 0x12, 0xb7, 0x12, 0x54, 0x42, 0x48, 0x38, 0xc0, 0x01, 0x09, + 0x59, 0x1b, 0x7b, 0x93, 0x6e, 0xbb, 0xd9, 0x75, 0xbd, 0x6b, 0x2a, 0xae, 0x7c, 0x01, 0xff, 0xc0, + 0xcf, 0xf4, 0x1b, 0x38, 0x84, 0xcf, 0xe0, 0x8a, 0xbc, 0x76, 0x62, 0x93, 0xb4, 0x10, 0x6e, 0xde, + 0xf1, 0xcc, 0xbc, 0xb1, 0xdf, 0x68, 0x61, 0x3b, 0x23, 0x69, 0xae, 0xb0, 0xa2, 0x82, 0xfb, 0x69, + 0x26, 0x94, 0x40, 0x50, 0x23, 0x2e, 0x8c, 0xc4, 0x48, 0x94, 0xb8, 0xeb, 0x8d, 0x84, 0x18, 0x31, + 0xd2, 0xd1, 0xa7, 0x41, 0x3e, 0xec, 0x28, 0x3a, 0x26, 0x52, 0xe1, 0x71, 0x5a, 0x12,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0x7f, 0x04, 0x8d, 0x4b, 0xc2, 0x31, + 0xf6, 0xcc, 0xb6, 0xd5, 0x7d, 0xd4, 0x5c, 0xfc, 0x75, 0x9d, 0x09, 0x1b, 0xba, 0xee, 0x77, 0x03, + 0xa0, 0x6e, 0x08, 0xfa, 0x04, 0xdb, 0xf3, 0x32, 0xb4, 0xff, 0x77, 0x53, 0x1d, 0xce, 0x5d, 0x6a, + 0x32, 0x3a, 0x00, 0xb3, 0xc7, 0x18, 0xda, 0x69, 0x92, 0xeb, 0x2f, 0x74, 0x77, 0x17, 0xf0, 0x52, + 0x17, 0x3c, 0xf8, 0xe8, 0x4a, 0x25, 0xb2, 0x53, 0x9f, 0x8a, 0x8e, 0x7e, 0xe8, 0x8c, 0x73, 0xa6, + 0x28, 0x17, 0x09, 0x49, 0x07, 0x83, 0x35, 0xfd, 0x63, 0x9f, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, + 0x13, 0x5c, 0xf1, 0xa4, 0x47, 0x05, 0x00, 0x00, +} + +// --- DRPC BEGIN --- + +type DRPCReputationClient interface { + DRPCConn() drpc.Conn + + GetBySatelliteID(ctx context.Context, in *GetBySatelliteIDRequest) (*GetBySatelliteIDResponse, error) + All(ctx context.Context, in *AllRequest) (*AllResponse, error) +} + +type drpcReputationClient struct { + cc drpc.Conn +} + +func NewDRPCReputationClient(cc drpc.Conn) DRPCReputationClient { + return &drpcReputationClient{cc} +} + +func (c *drpcReputationClient) DRPCConn() drpc.Conn { return c.cc } + +func (c *drpcReputationClient) GetBySatelliteID(ctx context.Context, in *GetBySatelliteIDRequest) (*GetBySatelliteIDResponse, error) { + out := new(GetBySatelliteIDResponse) + err := c.cc.Invoke(ctx, "/reputation.Reputation/GetBySatelliteID", in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcReputationClient) All(ctx context.Context, in *AllRequest) (*AllResponse, error) { + out := new(AllResponse) + err := c.cc.Invoke(ctx, "/reputation.Reputation/All", in, out) + if err != nil { + return nil, err + } + return out, nil +} + +type DRPCReputationServer interface { + GetBySatelliteID(context.Context, *GetBySatelliteIDRequest) (*GetBySatelliteIDResponse, error) + All(context.Context, *AllRequest) (*AllResponse, error) +} + +type DRPCReputationDescription struct{} + +func (DRPCReputationDescription) NumMethods() int { return 2 } + +func (DRPCReputationDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { + switch n { + case 0: + return "/reputation.Reputation/GetBySatelliteID", + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCReputationServer). + GetBySatelliteID( + ctx, + in1.(*GetBySatelliteIDRequest), + ) + }, DRPCReputationServer.GetBySatelliteID, true + case 1: + return "/reputation.Reputation/All", + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCReputationServer). + All( + ctx, + in1.(*AllRequest), + ) + }, DRPCReputationServer.All, true + default: + return "", nil, nil, false + } +} + +func DRPCRegisterReputation(mux drpc.Mux, impl DRPCReputationServer) error { + return mux.Register(impl, DRPCReputationDescription{}) +} + +type DRPCReputation_GetBySatelliteIDStream interface { + drpc.Stream + SendAndClose(*GetBySatelliteIDResponse) error +} + +type drpcReputationGetBySatelliteIDStream struct { + drpc.Stream +} + +func (x *drpcReputationGetBySatelliteIDStream) SendAndClose(m *GetBySatelliteIDResponse) error { + if err := x.MsgSend(m); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCReputation_AllStream interface { + drpc.Stream + SendAndClose(*AllResponse) error +} + +type drpcReputationAllStream struct { + drpc.Stream +} + +func (x *drpcReputationAllStream) SendAndClose(m *AllResponse) error { + if err := x.MsgSend(m); err != nil { + return err + } + return x.CloseSend() +} + +// --- DRPC END --- diff --git a/multinodepb/reputation.proto b/multinodepb/reputation.proto new file mode 100644 index 000000000..5abf9097d --- /dev/null +++ b/multinodepb/reputation.proto @@ -0,0 +1,46 @@ +// Copyright (C) 2020 Storj Labs, Inc. +// See LICENSE for copying information. + +syntax = "proto3"; +option go_package = "storj.io/storj/multinodepb"; + +package reputation; + +import "gogo.proto"; +import "google/protobuf/timestamp.proto"; + +service Reputation { + rpc GetBySatelliteID(GetBySatelliteIDRequest) returns (GetBySatelliteIDResponse); + rpc All(AllRequest) returns (AllResponse); +} + +message ReputationStats { + int64 total_count = 1; + int64 success_count = 2; + double reputation_alpha = 3; + double reputation_beta = 4; + double reputation_score = 5; + double unknown_reputation_alpha = 6; + double unknown_reputation_beta = 7; + double unknown_reputation_score = 8; +} + +message GetBySatelliteIDRequest { + bytes satellite_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; +} + +message GetBySatelliteIDResponse { + ReputationStats audit_check = 1; + google.protobuf.Timestamp disqualified = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; + google.protobuf.Timestamp suspended = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; + google.protobuf.Timestamp joined_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Timestamp offline_suspended = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; + double online_score = 6; + google.protobuf.Timestamp offline_under_review = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true]; +} + +message AllRequest {} + +message AllResponse { + repeated GetBySatelliteIDResponse reputation = 1; +} \ No newline at end of file diff --git a/multinodepb/status.pb.go b/multinodepb/status.pb.go new file mode 100644 index 000000000..396dd7a99 --- /dev/null +++ b/multinodepb/status.pb.go @@ -0,0 +1,202 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: status.proto + +package multinodepb + +import ( + context "context" + fmt "fmt" + math "math" + time "time" + + proto "github.com/gogo/protobuf/proto" + + drpc "storj.io/drpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type GetRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dfe4fce6682daf5b, []int{0} +} +func (m *GetRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetRequest.Unmarshal(m, b) +} +func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) +} +func (m *GetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRequest.Merge(m, src) +} +func (m *GetRequest) XXX_Size() int { + return xxx_messageInfo_GetRequest.Size(m) +} +func (m *GetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRequest proto.InternalMessageInfo + +type GetResponse struct { + StartedAt time.Time `protobuf:"bytes,1,opt,name=started_at,json=startedAt,proto3,stdtime" json:"started_at"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dfe4fce6682daf5b, []int{1} +} +func (m *GetResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetResponse.Unmarshal(m, b) +} +func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetResponse.Marshal(b, m, deterministic) +} +func (m *GetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetResponse.Merge(m, src) +} +func (m *GetResponse) XXX_Size() int { + return xxx_messageInfo_GetResponse.Size(m) +} +func (m *GetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetResponse proto.InternalMessageInfo + +func (m *GetResponse) GetStartedAt() time.Time { + if m != nil { + return m.StartedAt + } + return time.Time{} +} + +func (m *GetResponse) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func init() { + proto.RegisterType((*GetRequest)(nil), "status.GetRequest") + proto.RegisterType((*GetResponse)(nil), "status.GetResponse") +} + +func init() { proto.RegisterFile("status.proto", fileDescriptor_dfe4fce6682daf5b) } + +var fileDescriptor_dfe4fce6682daf5b = []byte{ + // 225 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x86, 0x09, 0x48, 0x81, 0x5e, 0x3b, 0x99, 0x25, 0xb2, 0x90, 0x52, 0x75, 0xea, 0xe4, 0x48, + 0x65, 0x61, 0xa5, 0x0c, 0xdd, 0x03, 0x13, 0x0b, 0x4a, 0xd4, 0xc3, 0x32, 0x4a, 0x72, 0xc6, 0x77, + 0xe6, 0x39, 0x78, 0x2c, 0x9e, 0x02, 0x5e, 0x05, 0xc9, 0x6e, 0x84, 0xd8, 0xee, 0xfb, 0x75, 0xf7, + 0xeb, 0x3b, 0x58, 0xb1, 0x74, 0x12, 0xd9, 0xf8, 0x40, 0x42, 0xaa, 0xcc, 0xa4, 0xc1, 0x92, 0xa5, + 0x9c, 0xe9, 0xda, 0x12, 0xd9, 0x01, 0x9b, 0x44, 0x7d, 0x7c, 0x6d, 0xc4, 0x8d, 0xc8, 0xd2, 0x8d, + 0x3e, 0x2f, 0x6c, 0x56, 0x00, 0x07, 0x94, 0x16, 0xdf, 0x23, 0xb2, 0x6c, 0x06, 0x58, 0x26, 0x62, + 0x4f, 0x13, 0xa3, 0x7a, 0x00, 0x60, 0xe9, 0x82, 0xe0, 0xf1, 0xa5, 0x93, 0xaa, 0x58, 0x17, 0xdb, + 0xe5, 0x4e, 0x9b, 0x5c, 0x69, 0xe6, 0x4a, 0xf3, 0x34, 0x57, 0xee, 0xaf, 0xbe, 0xbe, 0xeb, 0xb3, + 0xcf, 0x9f, 0xba, 0x68, 0x17, 0xa7, 0xbb, 0x7b, 0x51, 0x15, 0x5c, 0x7e, 0x60, 0x60, 0x47, 0x53, + 0x75, 0xbe, 0x2e, 0xb6, 0x8b, 0x76, 0xc6, 0xdd, 0x1d, 0x94, 0x8f, 0x49, 0x59, 0x19, 0xb8, 0x38, + 0xa0, 0x28, 0x65, 0x4e, 0x0f, 0xfd, 0x29, 0xe9, 0xeb, 0x7f, 0x59, 0x16, 0xdb, 0xdf, 0x3c, 0x6b, + 0x16, 0x0a, 0x6f, 0xc6, 0x51, 0x93, 0x86, 0x66, 0x8c, 0x83, 0xb8, 0x89, 0x8e, 0xe8, 0xfb, 0xbe, + 0x4c, 0x6a, 0xb7, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x81, 0x06, 0x90, 0x45, 0x1f, 0x01, 0x00, + 0x00, +} + +// --- DRPC BEGIN --- + +type DRPCStatusClient interface { + DRPCConn() drpc.Conn + + Get(ctx context.Context, in *GetRequest) (*GetResponse, error) +} + +type drpcStatusClient struct { + cc drpc.Conn +} + +func NewDRPCStatusClient(cc drpc.Conn) DRPCStatusClient { + return &drpcStatusClient{cc} +} + +func (c *drpcStatusClient) DRPCConn() drpc.Conn { return c.cc } + +func (c *drpcStatusClient) Get(ctx context.Context, in *GetRequest) (*GetResponse, error) { + out := new(GetResponse) + err := c.cc.Invoke(ctx, "/status.Status/Get", in, out) + if err != nil { + return nil, err + } + return out, nil +} + +type DRPCStatusServer interface { + Get(context.Context, *GetRequest) (*GetResponse, error) +} + +type DRPCStatusDescription struct{} + +func (DRPCStatusDescription) NumMethods() int { return 1 } + +func (DRPCStatusDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) { + switch n { + case 0: + return "/status.Status/Get", + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCStatusServer). + Get( + ctx, + in1.(*GetRequest), + ) + }, DRPCStatusServer.Get, true + default: + return "", nil, nil, false + } +} + +func DRPCRegisterStatus(mux drpc.Mux, impl DRPCStatusServer) error { + return mux.Register(impl, DRPCStatusDescription{}) +} + +type DRPCStatus_GetStream interface { + drpc.Stream + SendAndClose(*GetResponse) error +} + +type drpcStatusGetStream struct { + drpc.Stream +} + +func (x *drpcStatusGetStream) SendAndClose(m *GetResponse) error { + if err := x.MsgSend(m); err != nil { + return err + } + return x.CloseSend() +} + +// --- DRPC END --- diff --git a/multinodepb/status.proto b/multinodepb/status.proto new file mode 100644 index 000000000..c0a11197c --- /dev/null +++ b/multinodepb/status.proto @@ -0,0 +1,21 @@ +// Copyright (C) 2020 Storj Labs, Inc. +// See LICENSE for copying information. + +syntax = "proto3"; +option go_package = "storj.io/storj/multinodepb"; + +package status; + +import "gogo.proto"; +import "google/protobuf/timestamp.proto"; + +service Status { + rpc Get(GetRequest) returns (GetResponse); +} + +message GetRequest {} + +message GetResponse { + google.protobuf.Timestamp started_at = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + string version = 2; // must be semver formatted +} diff --git a/multinodepb/types.go b/multinodepb/types.go new file mode 100644 index 000000000..aa607cb40 --- /dev/null +++ b/multinodepb/types.go @@ -0,0 +1,36 @@ +// Copyright (C) 2019 Storj Labs, Inc. +// See LICENSE for copying information. + +package multinodepb + +import "storj.io/common/storj" + +// Path represents a object path. +type Path = storj.Path + +// NodeID is an alias to storj.NodeID for use in generated protobuf code. +type NodeID = storj.NodeID + +// NodeIDList is an alias to storj.NodeIDList for use in generated protobuf code. +type NodeIDList = storj.NodeIDList + +// PieceID is an alias to storj.PieceID for use in generated protobuf code. +type PieceID = storj.PieceID + +// PiecePublicKey is an alias to storj.PiecePublicKey for use in generated protobuf code. +type PiecePublicKey = storj.PiecePublicKey + +// PiecePrivateKey is an alias to storj.PiecePrivateKey for use in generated protobuf code. +type PiecePrivateKey = storj.PiecePrivateKey + +// SerialNumber is an alias to storj.SerialNumber for use in generated protobuf code. +type SerialNumber = storj.SerialNumber + +// StreamID is an alias to storj.StreamID for use in generated protobuf code. +type StreamID = storj.StreamID + +// Nonce is an alias to storj.Nonce for use in generated protobuf code. +type Nonce = storj.Nonce + +// SegmentID is an alias to storj.SegmentID for use in generated protobuf code. +type SegmentID = storj.SegmentID