multinode/console: list node infos
Change-Id: I5cac49feff2bac6fbd7ac61dfccffd672da8e8c0
This commit is contained in:
parent
16a8b1da35
commit
fb00d099cf
@ -133,7 +133,7 @@ func init() {
|
|||||||
process.Bind(dashboardCmd, &dashboardCfg, defaults, cfgstruct.ConfDir(defaultDiagDir))
|
process.Bind(dashboardCmd, &dashboardCfg, defaults, cfgstruct.ConfDir(defaultDiagDir))
|
||||||
process.Bind(gracefulExitInitCmd, &diagCfg, defaults, cfgstruct.ConfDir(defaultDiagDir))
|
process.Bind(gracefulExitInitCmd, &diagCfg, defaults, cfgstruct.ConfDir(defaultDiagDir))
|
||||||
process.Bind(gracefulExitStatusCmd, &diagCfg, defaults, cfgstruct.ConfDir(defaultDiagDir))
|
process.Bind(gracefulExitStatusCmd, &diagCfg, defaults, cfgstruct.ConfDir(defaultDiagDir))
|
||||||
process.Bind(issueAPITokenCmd, &runCfg, defaults, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
process.Bind(issueAPITokenCmd, &diagCfg, defaults, cfgstruct.ConfDir(confDir), cfgstruct.IdentityDir(identityDir))
|
||||||
}
|
}
|
||||||
|
|
||||||
func cmdRun(cmd *cobra.Command, args []string) (err error) {
|
func cmdRun(cmd *cobra.Command, args []string) (err error) {
|
||||||
@ -312,14 +312,14 @@ func cmdIssue(cmd *cobra.Command, args []string) (err error) {
|
|||||||
err = errs.Combine(err, db.Close())
|
err = errs.Combine(err, db.Close())
|
||||||
}()
|
}()
|
||||||
|
|
||||||
service := apikeys.NewService(db.Secret())
|
service := apikeys.NewService(db.APIKeys())
|
||||||
|
|
||||||
apiKey, err := service.Issue(ctx)
|
apiKey, err := service.Issue(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errs.New("Error while trying to issue new api key: %v", err)
|
return errs.New("Error while trying to issue new api key: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Print(apiKey.Secret.String())
|
fmt.Println(apiKey.Secret.String())
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
|
|
||||||
"storj.io/common/storj"
|
"storj.io/common/storj"
|
||||||
"storj.io/storj/multinode/nodes"
|
"storj.io/storj/multinode/nodes"
|
||||||
|
"storj.io/storj/private/multinodeauth"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -59,13 +60,13 @@ func (controller *Nodes) Add(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
apiSecret, err := nodes.APISecretFromBase64(payload.APISecret)
|
apiSecret, err := multinodeauth.SecretFromBase64(payload.APISecret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
controller.serveError(w, http.StatusBadRequest, ErrNodes.Wrap(err))
|
controller.serveError(w, http.StatusBadRequest, ErrNodes.Wrap(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = controller.service.Add(ctx, id, apiSecret, payload.PublicAddress); err != nil {
|
if err = controller.service.Add(ctx, id, apiSecret[:], payload.PublicAddress); err != nil {
|
||||||
// TODO: add more error checks in future, like bad payload if address is invalid or unauthorized if secret invalid.
|
// TODO: add more error checks in future, like bad payload if address is invalid or unauthorized if secret invalid.
|
||||||
controller.log.Error("add node internal error", zap.Error(err))
|
controller.log.Error("add node internal error", zap.Error(err))
|
||||||
controller.serveError(w, http.StatusInternalServerError, ErrNodes.Wrap(err))
|
controller.serveError(w, http.StatusInternalServerError, ErrNodes.Wrap(err))
|
||||||
@ -150,14 +151,14 @@ func (controller *Nodes) List(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
|
|
||||||
nodes, err := controller.service.List(ctx)
|
list, err := controller.service.List(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
controller.log.Error("list nodes internal error", zap.Error(err))
|
controller.log.Error("list nodes internal error", zap.Error(err))
|
||||||
controller.serveError(w, http.StatusInternalServerError, ErrNodes.Wrap(err))
|
controller.serveError(w, http.StatusInternalServerError, ErrNodes.Wrap(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = json.NewEncoder(w).Encode(nodes); err != nil {
|
if err = json.NewEncoder(w).Encode(list); err != nil {
|
||||||
controller.log.Error("failed to write json response", zap.Error(err))
|
controller.log.Error("failed to write json response", zap.Error(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -193,6 +194,27 @@ func (controller *Nodes) Delete(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListInfos handles node info list retrieval.
|
||||||
|
func (controller *Nodes) ListInfos(w http.ResponseWriter, r *http.Request) {
|
||||||
|
ctx := r.Context()
|
||||||
|
var err error
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
w.Header().Add("Content-Type", "application/json")
|
||||||
|
|
||||||
|
infos, err := controller.service.ListInfos(ctx)
|
||||||
|
if err != nil {
|
||||||
|
controller.log.Error("list node infos internal error", zap.Error(err))
|
||||||
|
controller.serveError(w, http.StatusInternalServerError, ErrNodes.Wrap(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = json.NewEncoder(w).Encode(infos); err != nil {
|
||||||
|
controller.log.Error("failed to write json response", zap.Error(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// serveError set http statuses and send json error.
|
// serveError set http statuses and send json error.
|
||||||
func (controller *Nodes) serveError(w http.ResponseWriter, status int, err error) {
|
func (controller *Nodes) serveError(w http.ResponseWriter, status int, err error) {
|
||||||
w.WriteHeader(status)
|
w.WriteHeader(status)
|
||||||
|
@ -58,6 +58,7 @@ func NewServer(log *zap.Logger, config Config, nodes *nodes.Service, listener ne
|
|||||||
nodesRouter := apiRouter.PathPrefix("/nodes").Subrouter()
|
nodesRouter := apiRouter.PathPrefix("/nodes").Subrouter()
|
||||||
nodesRouter.HandleFunc("", nodesController.Add).Methods(http.MethodPost)
|
nodesRouter.HandleFunc("", nodesController.Add).Methods(http.MethodPost)
|
||||||
nodesRouter.HandleFunc("", nodesController.List).Methods(http.MethodGet)
|
nodesRouter.HandleFunc("", nodesController.List).Methods(http.MethodGet)
|
||||||
|
nodesRouter.HandleFunc("/infos", nodesController.ListInfos).Methods(http.MethodGet)
|
||||||
nodesRouter.HandleFunc("/{id}", nodesController.Get).Methods(http.MethodGet)
|
nodesRouter.HandleFunc("/{id}", nodesController.Get).Methods(http.MethodGet)
|
||||||
nodesRouter.HandleFunc("/{id}", nodesController.UpdateName).Methods(http.MethodPatch)
|
nodesRouter.HandleFunc("/{id}", nodesController.UpdateName).Methods(http.MethodPatch)
|
||||||
nodesRouter.HandleFunc("/{id}", nodesController.Delete).Methods(http.MethodDelete)
|
nodesRouter.HandleFunc("/{id}", nodesController.Delete).Methods(http.MethodDelete)
|
||||||
|
@ -5,15 +5,13 @@ package nodes
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"time"
|
||||||
|
|
||||||
"github.com/zeebo/errs"
|
"github.com/zeebo/errs"
|
||||||
|
|
||||||
"storj.io/common/storj"
|
"storj.io/common/storj"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: should this file be placed outside of console in nodes package?
|
|
||||||
|
|
||||||
// DB exposes needed by MND NodesDB functionality.
|
// DB exposes needed by MND NodesDB functionality.
|
||||||
//
|
//
|
||||||
// architecture: Database
|
// architecture: Database
|
||||||
@ -42,7 +40,13 @@ type Node struct {
|
|||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
// APISecretFromBase64 decodes API secret from base 64 string.
|
// NodeInfo contains basic node internal state.
|
||||||
func APISecretFromBase64(s string) ([]byte, error) {
|
type NodeInfo struct {
|
||||||
return base64.URLEncoding.DecodeString(s)
|
ID storj.NodeID
|
||||||
|
Name string
|
||||||
|
Version string
|
||||||
|
LastContact time.Time
|
||||||
|
DiskSpaceUsed int64
|
||||||
|
DiskSpaceLeft int64
|
||||||
|
BandwidthUsed int64
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,9 @@ import (
|
|||||||
"github.com/zeebo/errs"
|
"github.com/zeebo/errs"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"storj.io/common/rpc"
|
||||||
"storj.io/common/storj"
|
"storj.io/common/storj"
|
||||||
|
"storj.io/storj/private/multinodepb"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -24,15 +26,17 @@ var (
|
|||||||
//
|
//
|
||||||
// architecture: Service
|
// architecture: Service
|
||||||
type Service struct {
|
type Service struct {
|
||||||
log *zap.Logger
|
log *zap.Logger
|
||||||
nodes DB
|
dialer rpc.Dialer
|
||||||
|
nodes DB
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewService creates new instance of Service.
|
// NewService creates new instance of Service.
|
||||||
func NewService(log *zap.Logger, nodes DB) *Service {
|
func NewService(log *zap.Logger, dialer rpc.Dialer, nodes DB) *Service {
|
||||||
return &Service{
|
return &Service{
|
||||||
log: log,
|
log: log,
|
||||||
nodes: nodes,
|
dialer: dialer,
|
||||||
|
nodes: nodes,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,3 +82,78 @@ func (service *Service) Remove(ctx context.Context, id storj.NodeID) (err error)
|
|||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
return Error.Wrap(service.nodes.Remove(ctx, id))
|
return Error.Wrap(service.nodes.Remove(ctx, id))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListInfos queries node basic info from all nodes via rpc.
|
||||||
|
func (service *Service) ListInfos(ctx context.Context) (_ []NodeInfo, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
nodes, err := service.nodes.List(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var infos []NodeInfo
|
||||||
|
for _, node := range nodes {
|
||||||
|
info, err := func() (_ NodeInfo, err error) {
|
||||||
|
conn, err := service.dialer.DialNodeURL(ctx, storj.NodeURL{
|
||||||
|
ID: node.ID,
|
||||||
|
Address: node.PublicAddress,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return NodeInfo{}, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
err = errs.Combine(err, conn.Close())
|
||||||
|
}()
|
||||||
|
|
||||||
|
nodeClient := multinodepb.NewDRPCNodeClient(conn)
|
||||||
|
storageClient := multinodepb.NewDRPCStorageClient(conn)
|
||||||
|
bandwidthClient := multinodepb.NewDRPCBandwidthClient(conn)
|
||||||
|
|
||||||
|
header := &multinodepb.RequestHeader{
|
||||||
|
ApiKey: node.APISecret,
|
||||||
|
}
|
||||||
|
|
||||||
|
bandwidthSummaryRequest := &multinodepb.BandwidthMonthSummaryRequest{
|
||||||
|
Header: header,
|
||||||
|
}
|
||||||
|
bandwidthSummary, err := bandwidthClient.MonthSummary(ctx, bandwidthSummaryRequest)
|
||||||
|
if err != nil {
|
||||||
|
return NodeInfo{}, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
diskSpace, err := storageClient.DiskSpace(ctx, &multinodepb.DiskSpaceRequest{Header: header})
|
||||||
|
if err != nil {
|
||||||
|
return NodeInfo{}, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeVersion, err := nodeClient.Version(ctx, &multinodepb.VersionRequest{Header: header})
|
||||||
|
if err != nil {
|
||||||
|
return NodeInfo{}, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
lastContact, err := nodeClient.LastContact(ctx, &multinodepb.LastContactRequest{Header: header})
|
||||||
|
if err != nil {
|
||||||
|
return NodeInfo{}, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return NodeInfo{
|
||||||
|
ID: node.ID,
|
||||||
|
Name: node.Name,
|
||||||
|
Version: nodeVersion.Version,
|
||||||
|
LastContact: lastContact.LastContact,
|
||||||
|
DiskSpaceUsed: diskSpace.GetUsedPieces() + diskSpace.GetUsedTrash(),
|
||||||
|
DiskSpaceLeft: diskSpace.GetAvailable(),
|
||||||
|
BandwidthUsed: bandwidthSummary.GetUsed(),
|
||||||
|
}, nil
|
||||||
|
}()
|
||||||
|
if err != nil {
|
||||||
|
return nil, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
infos = append(infos, info)
|
||||||
|
}
|
||||||
|
|
||||||
|
return infos, nil
|
||||||
|
}
|
||||||
|
@ -12,6 +12,8 @@ import (
|
|||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
|
||||||
"storj.io/common/identity"
|
"storj.io/common/identity"
|
||||||
|
"storj.io/common/peertls/tlsopts"
|
||||||
|
"storj.io/common/rpc"
|
||||||
"storj.io/private/debug"
|
"storj.io/private/debug"
|
||||||
"storj.io/storj/multinode/console"
|
"storj.io/storj/multinode/console"
|
||||||
"storj.io/storj/multinode/console/server"
|
"storj.io/storj/multinode/console/server"
|
||||||
@ -55,6 +57,8 @@ type Peer struct {
|
|||||||
Identity *identity.FullIdentity
|
Identity *identity.FullIdentity
|
||||||
DB DB
|
DB DB
|
||||||
|
|
||||||
|
Dialer rpc.Dialer
|
||||||
|
|
||||||
// contains logic of nodes domain.
|
// contains logic of nodes domain.
|
||||||
Nodes struct {
|
Nodes struct {
|
||||||
Service *nodes.Service
|
Service *nodes.Service
|
||||||
@ -78,9 +82,22 @@ func New(log *zap.Logger, full *identity.FullIdentity, config Config, db DB) (_
|
|||||||
Servers: lifecycle.NewGroup(log.Named("servers")),
|
Servers: lifecycle.NewGroup(log.Named("servers")),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tlsConfig := tlsopts.Config{
|
||||||
|
UsePeerCAWhitelist: false,
|
||||||
|
PeerIDVersions: "0",
|
||||||
|
}
|
||||||
|
|
||||||
|
tlsOptions, err := tlsopts.NewOptions(peer.Identity, tlsConfig, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
peer.Dialer = rpc.NewDefaultDialer(tlsOptions)
|
||||||
|
|
||||||
{ // nodes setup
|
{ // nodes setup
|
||||||
peer.Nodes.Service = nodes.NewService(
|
peer.Nodes.Service = nodes.NewService(
|
||||||
peer.Log.Named("nodes:service"),
|
peer.Log.Named("nodes:service"),
|
||||||
|
peer.Dialer,
|
||||||
peer.DB.Nodes(),
|
peer.DB.Nodes(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,579 +0,0 @@
|
|||||||
// 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, 0x64, 0x38, 0xe1, 0xf2, 0x74, 0xa6, 0xc0, 0x3e, 0xfb, 0x92, 0x33, 0x89, 0xee, 0x2b,
|
|
||||||
0xe8, 0xad, 0xa7, 0x65, 0x2a, 0xce, 0x24, 0x23, 0x47, 0x00, 0xea, 0xa1, 0x40, 0xbf, 0x64, 0x1b,
|
|
||||||
0xfb, 0xc6, 0x41, 0x67, 0xd4, 0xf3, 0x2a, 0x32, 0x15, 0x42, 0x13, 0xd2, 0x47, 0x57, 0x40, 0xbb,
|
|
||||||
0xcc, 0x13, 0x02, 0xcd, 0x5c, 0xb2, 0x50, 0x63, 0x1b, 0xbe, 0x3e, 0x93, 0x3d, 0x68, 0xd3, 0x05,
|
|
||||||
0xe5, 0x31, 0x9d, 0xc7, 0xcc, 0x36, 0xf5, 0x45, 0x95, 0x20, 0x3d, 0xb8, 0x8b, 0x19, 0x95, 0x9f,
|
|
||||||
0xec, 0x86, 0xbe, 0x29, 0x02, 0xe2, 0xc0, 0x96, 0x58, 0xb0, 0x4c, 0xf7, 0x6a, 0xea, 0x8b, 0x32,
|
|
||||||
0x76, 0x7f, 0x1a, 0x60, 0x4f, 0x28, 0x8f, 0xcf, 0x67, 0x28, 0x32, 0x1a, 0xb1, 0xb7, 0x92, 0x46,
|
|
||||||
0xab, 0xaf, 0x91, 0xe7, 0xd0, 0x3c, 0xc9, 0x44, 0xb2, 0x24, 0xef, 0x78, 0x85, 0x42, 0xde, 0x4a,
|
|
||||||
0x21, 0xef, 0x78, 0xa5, 0xd0, 0x78, 0xeb, 0xd7, 0x45, 0xff, 0xce, 0xb7, 0x3f, 0x7d, 0xc3, 0xd7,
|
|
||||||
0x08, 0xf2, 0x0c, 0x4c, 0x14, 0x9a, 0xdf, 0x6d, 0x71, 0x26, 0x0a, 0x72, 0x08, 0x96, 0xa4, 0xc8,
|
|
||||||
0xe2, 0x98, 0x23, 0x0b, 0x78, 0xa8, 0x7f, 0x61, 0x8d, 0xef, 0xab, 0x9a, 0xdf, 0x17, 0xfd, 0xd6,
|
|
||||||
0x6b, 0x11, 0xb2, 0xe9, 0xc4, 0xef, 0x94, 0x35, 0xd3, 0xd0, 0xfd, 0x6a, 0xc2, 0xe3, 0x6b, 0xf8,
|
|
||||||
0x2f, 0x3d, 0xd8, 0x85, 0x7b, 0x67, 0x22, 0xd4, 0xbd, 0xd4, 0x1f, 0x2c, 0xbf, 0xa5, 0xc2, 0x69,
|
|
||||||
0x48, 0x28, 0xec, 0x84, 0x0a, 0x15, 0xc8, 0x02, 0x16, 0xe4, 0x0a, 0x67, 0x9b, 0xfb, 0x8d, 0x83,
|
|
||||||
0xce, 0xe8, 0xb0, 0xee, 0xd2, 0xa6, 0xde, 0xde, 0x5a, 0x72, 0x3b, 0xbc, 0x5c, 0xe7, 0x2c, 0xc0,
|
|
||||||
0xaa, 0xc7, 0xc4, 0x85, 0x2e, 0xc5, 0x20, 0x63, 0x12, 0x03, 0x14, 0x48, 0x63, 0xcd, 0xc8, 0xf0,
|
|
||||||
0x3b, 0x14, 0x7d, 0x26, 0xf1, 0x58, 0xa5, 0xc8, 0x18, 0xda, 0xe5, 0xd4, 0xfd, 0x93, 0x7a, 0x15,
|
|
||||||
0xcc, 0xfd, 0x61, 0xc0, 0xee, 0x6c, 0xa5, 0xd0, 0x2c, 0x4f, 0x12, 0x9a, 0x9d, 0xff, 0x47, 0x86,
|
|
||||||
0xbe, 0x00, 0xfb, 0x2a, 0xfb, 0xa5, 0x9d, 0x03, 0xe8, 0xae, 0xfb, 0x55, 0x48, 0x68, 0xc9, 0x9a,
|
|
||||||
0xce, 0xa3, 0xef, 0x26, 0x74, 0x55, 0xe3, 0x6a, 0x8f, 0xde, 0x80, 0x55, 0xdf, 0x50, 0xf2, 0xa4,
|
|
||||||
0xe6, 0xef, 0x35, 0x1b, 0xed, 0xf4, 0x37, 0xde, 0x2f, 0x79, 0x7c, 0x80, 0xed, 0x2b, 0x73, 0x41,
|
|
||||||
0x06, 0x37, 0x4f, 0x4d, 0xd1, 0xfa, 0xe9, 0x6d, 0x46, 0x8b, 0xbc, 0x87, 0x87, 0x97, 0x35, 0x20,
|
|
||||||
0x6e, 0x0d, 0xb9, 0xc1, 0x5e, 0x67, 0x70, 0x63, 0x4d, 0xd1, 0x7c, 0xbc, 0xf7, 0xce, 0x51, 0x7a,
|
|
||||||
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 ---
|
|
@ -1,56 +0,0 @@
|
|||||||
// 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;
|
|
||||||
}
|
|
@ -1,466 +0,0 @@
|
|||||||
// 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, 0x5a, 0x5f,
|
|
||||||
0x4d, 0xd8, 0x0a, 0x67, 0xda, 0xbe, 0xc2, 0x4a, 0x22, 0x0f, 0x2c, 0x25, 0x14, 0x66, 0x51, 0x2c,
|
|
||||||
0x72, 0xae, 0x1c, 0x63, 0xcf, 0x68, 0x9b, 0x21, 0x68, 0xe8, 0xb0, 0x40, 0xd0, 0x3e, 0xdc, 0x96,
|
|
||||||
0x79, 0x1c, 0x13, 0x29, 0x2b, 0xca, 0x0d, 0x4d, 0xb1, 0x2b, 0xb0, 0x24, 0x3d, 0x69, 0xc6, 0x8c,
|
|
||||||
0x30, 0x4b, 0x4f, 0xb0, 0x63, 0xee, 0x19, 0x6d, 0x23, 0xdc, 0xaa, 0xf1, 0x5e, 0x01, 0xa3, 0xc7,
|
|
||||||
0xd0, 0x80, 0xa2, 0x01, 0x51, 0xd8, 0xb9, 0xa9, 0x99, 0x9b, 0x35, 0x1c, 0x10, 0x85, 0xe7, 0x3c,
|
|
||||||
0x65, 0x2c, 0x32, 0xe2, 0xac, 0xce, 0x7b, 0xf6, 0x0b, 0x18, 0x3d, 0x07, 0x27, 0xe7, 0x67, 0x5c,
|
|
||||||
0x5c, 0xf0, 0x68, 0x21, 0xc6, 0x9a, 0x96, 0xec, 0x54, 0xef, 0xc3, 0xb9, 0x34, 0x07, 0xb0, 0x7b,
|
|
||||||
0x85, 0x52, 0xa7, 0xba, 0xa5, 0x85, 0xf7, 0x16, 0x84, 0x3a, 0xdc, 0xd5, 0x13, 0xcb, 0x90, 0xeb,
|
|
||||||
0xd7, 0x4c, 0xd4, 0x59, 0x5b, 0xaf, 0x61, 0xf7, 0x25, 0x51, 0xc1, 0x97, 0x3e, 0x56, 0x84, 0x31,
|
|
||||||
0xaa, 0xc8, 0xf1, 0x51, 0x48, 0xce, 0x73, 0x22, 0x15, 0x7a, 0x0a, 0xb6, 0x9c, 0xa2, 0x11, 0x4d,
|
|
||||||
0xf4, 0x32, 0xec, 0x60, 0xf3, 0x72, 0xe2, 0xad, 0xfc, 0x98, 0x78, 0x6b, 0x6f, 0x44, 0x52, 0x90,
|
|
||||||
0xad, 0x19, 0xe7, 0x38, 0x69, 0xfd, 0x32, 0xc1, 0x59, 0xb4, 0x93, 0xa9, 0xe0, 0x92, 0xa0, 0x17,
|
|
||||||
0x60, 0xe1, 0x3c, 0xa1, 0x2a, 0x8a, 0x4f, 0x48, 0x7c, 0xa6, 0xed, 0xac, 0xee, 0x7d, 0xbf, 0x51,
|
|
||||||
0xa8, 0xb9, 0x36, 0x84, 0xa0, 0xf9, 0x87, 0x05, 0x1d, 0xbd, 0x02, 0x3b, 0xa1, 0xf2, 0x3c, 0xc7,
|
|
||||||
0x8c, 0x0e, 0x29, 0x49, 0xf4, 0xde, 0xad, 0xae, 0xeb, 0x97, 0x2d, 0xf3, 0xa7, 0x2d, 0xf3, 0xdf,
|
|
||||||
0x4d, 0x5b, 0x16, 0xac, 0x5f, 0x4e, 0x3c, 0xe3, 0xdb, 0x4f, 0xcf, 0x08, 0xff, 0x50, 0xa2, 0x00,
|
|
||||||
0x36, 0x64, 0x2e, 0x53, 0xc2, 0x13, 0x92, 0xe8, 0x5a, 0x2c, 0x6b, 0x53, 0xcb, 0x50, 0x0f, 0x36,
|
|
||||||
0x4e, 0x05, 0xe5, 0x24, 0x89, 0xb0, 0xd2, 0x85, 0xf9, 0xb7, 0xc7, 0x8a, 0xf6, 0x58, 0x2f, 0x65,
|
|
||||||
0x3d, 0x85, 0xde, 0xc2, 0x1d, 0x31, 0x1c, 0x32, 0xca, 0x49, 0x54, 0xc7, 0x59, 0xfd, 0x8f, 0x38,
|
|
||||||
0xdb, 0x95, 0xbc, 0x3f, 0x4b, 0xf5, 0x10, 0x6c, 0xc1, 0x4b, 0x47, 0xbd, 0xfa, 0xb2, 0x6c, 0x56,
|
|
||||||
0x89, 0x95, 0xdd, 0xfc, 0x00, 0x77, 0xa7, 0x53, 0x73, 0x9e, 0x90, 0x2c, 0xca, 0xc8, 0x67, 0x4a,
|
|
||||||
0x2e, 0x74, 0xbd, 0x96, 0x1d, 0x8c, 0x2a, 0x87, 0xf7, 0x85, 0x41, 0xa8, 0xf5, 0x2d, 0x1b, 0xa0,
|
|
||||||
0xc7, 0x58, 0x55, 0x9d, 0x56, 0x1f, 0x2c, 0x7d, 0xaa, 0x36, 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 ---
|
|
@ -1,46 +0,0 @@
|
|||||||
// 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;
|
|
||||||
}
|
|
@ -1,202 +0,0 @@
|
|||||||
// 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 ---
|
|
@ -1,21 +0,0 @@
|
|||||||
// 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
|
|
||||||
}
|
|
61
private/multinodeauth/auth.go
Normal file
61
private/multinodeauth/auth.go
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// Copyright (C) 2020 Storj Labs, Inc.
|
||||||
|
// See LICENSE for copying information.
|
||||||
|
|
||||||
|
package multinodeauth
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"crypto/rand"
|
||||||
|
"encoding/base64"
|
||||||
|
|
||||||
|
"github.com/zeebo/errs"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Secret crypto random 32 bytes array for multinode auth.
|
||||||
|
type Secret [32]byte
|
||||||
|
|
||||||
|
// NewSecret creates new multinode auth secret.
|
||||||
|
func NewSecret() (Secret, error) {
|
||||||
|
var b [32]byte
|
||||||
|
|
||||||
|
_, err := rand.Read(b[:])
|
||||||
|
if err != nil {
|
||||||
|
return b, errs.New("error creating multinode auth secret")
|
||||||
|
}
|
||||||
|
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// String implements Stringer.
|
||||||
|
func (secret Secret) String() string {
|
||||||
|
return base64.URLEncoding.EncodeToString(secret[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsZero returns if secret is not set.
|
||||||
|
func (secret Secret) IsZero() bool {
|
||||||
|
var zero Secret
|
||||||
|
// this doesn't need to be constant-time, because we're explicitly testing
|
||||||
|
// against a hardcoded, well-known value
|
||||||
|
return bytes.Equal(secret[:], zero[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
// SecretFromBase64 creates new secret from base64 string.
|
||||||
|
func SecretFromBase64(s string) (Secret, error) {
|
||||||
|
b, err := base64.URLEncoding.DecodeString(s)
|
||||||
|
if err != nil {
|
||||||
|
return Secret{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return SecretFromBytes(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SecretFromBytes creates secret from bytes slice.
|
||||||
|
func SecretFromBytes(b []byte) (Secret, error) {
|
||||||
|
if len(b) != 32 {
|
||||||
|
return Secret{}, errs.New("invalid secret")
|
||||||
|
}
|
||||||
|
|
||||||
|
var secret Secret
|
||||||
|
copy(secret[:], b)
|
||||||
|
return secret, nil
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2020 Storj Labs, Inc.
|
// Copyright (C) 2020 Storj Labs, Inc.
|
||||||
// See LICENSE for copying information.
|
// See LICENSE for copying information.
|
||||||
|
|
||||||
// Package multinodepb contains protobuf definitions for Storj peers.
|
// Package multinodepb contains protobuf definitions for storagenode multinode dashboard.
|
||||||
package multinodepb
|
package multinodepb
|
||||||
|
|
||||||
//go:generate go run gen.go
|
//go:generate go run gen.go
|
@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
mainpkg = flag.String("pkg", "storj.io/storj/multinodepb", "main package name")
|
mainpkg = flag.String("pkg", "storj.io/storj/private/multinodepb", "main package name")
|
||||||
protoc = flag.String("protoc", "protoc", "protoc compiler")
|
protoc = flag.String("protoc", "protoc", "protoc compiler")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ func main() {
|
|||||||
|
|
||||||
protofiles = ignore(protofiles)
|
protofiles = ignore(protofiles)
|
||||||
|
|
||||||
overrideImports := ",Mgoogle/protobuf/timestamp.proto=storj.io/storj/multinodepb"
|
overrideImports := ",Mgoogle/protobuf/timestamp.proto=" + *mainpkg
|
||||||
args := []string{
|
args := []string{
|
||||||
"--lint_out=.",
|
"--lint_out=.",
|
||||||
"--drpc_out=plugins=drpc,paths=source_relative" + overrideImports + ":.",
|
"--drpc_out=plugins=drpc,paths=source_relative" + overrideImports + ":.",
|
||||||
@ -75,7 +75,9 @@ func main() {
|
|||||||
cmd := exec.Command(*protoc, args...)
|
cmd := exec.Command(*protoc, args...)
|
||||||
fmt.Println(strings.Join(cmd.Args, " "))
|
fmt.Println(strings.Join(cmd.Args, " "))
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
fmt.Println(string(out))
|
if len(out) > 0 {
|
||||||
|
fmt.Println(string(out))
|
||||||
|
}
|
||||||
check(err)
|
check(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +92,9 @@ func main() {
|
|||||||
{
|
{
|
||||||
// format code to get rid of extra imports
|
// format code to get rid of extra imports
|
||||||
out, err := exec.Command("goimports", "-local", "storj.io", "-w", ".").CombinedOutput()
|
out, err := exec.Command("goimports", "-local", "storj.io", "-w", ".").CombinedOutput()
|
||||||
fmt.Println(string(out))
|
if len(out) > 0 {
|
||||||
|
fmt.Println(string(out))
|
||||||
|
}
|
||||||
check(err)
|
check(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -78,8 +78,8 @@ extend google.protobuf.FileOptions {
|
|||||||
optional bool gogoproto_import = 63027;
|
optional bool gogoproto_import = 63027;
|
||||||
optional bool protosizer_all = 63028;
|
optional bool protosizer_all = 63028;
|
||||||
optional bool compare_all = 63029;
|
optional bool compare_all = 63029;
|
||||||
optional bool typedecl_all = 63030;
|
optional bool typedecl_all = 63030;
|
||||||
optional bool enumdecl_all = 63031;
|
optional bool enumdecl_all = 63031;
|
||||||
|
|
||||||
optional bool goproto_registration = 63032;
|
optional bool goproto_registration = 63032;
|
||||||
optional bool messagename_all = 63033;
|
optional bool messagename_all = 63033;
|
||||||
@ -139,5 +139,4 @@ extend google.protobuf.FieldOptions {
|
|||||||
optional bool stdduration = 65011;
|
optional bool stdduration = 65011;
|
||||||
optional bool wktpointer = 65012;
|
optional bool wktpointer = 65012;
|
||||||
optional bool compare = 65013;
|
optional bool compare = 65013;
|
||||||
|
|
||||||
}
|
}
|
707
private/multinodepb/multinode.pb.go
Normal file
707
private/multinodepb/multinode.pb.go
Normal file
@ -0,0 +1,707 @@
|
|||||||
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||||
|
// source: multinode.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.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
type RequestHeader struct {
|
||||||
|
ApiKey []byte `protobuf:"bytes,1,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RequestHeader) Reset() { *m = RequestHeader{} }
|
||||||
|
func (m *RequestHeader) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*RequestHeader) ProtoMessage() {}
|
||||||
|
func (*RequestHeader) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{0}
|
||||||
|
}
|
||||||
|
func (m *RequestHeader) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_RequestHeader.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *RequestHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_RequestHeader.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *RequestHeader) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_RequestHeader.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *RequestHeader) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_RequestHeader.Size(m)
|
||||||
|
}
|
||||||
|
func (m *RequestHeader) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_RequestHeader.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_RequestHeader proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *RequestHeader) GetApiKey() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.ApiKey
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DiskSpaceRequest struct {
|
||||||
|
Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DiskSpaceRequest) Reset() { *m = DiskSpaceRequest{} }
|
||||||
|
func (m *DiskSpaceRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*DiskSpaceRequest) ProtoMessage() {}
|
||||||
|
func (*DiskSpaceRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{1}
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_DiskSpaceRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_DiskSpaceRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_DiskSpaceRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_DiskSpaceRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_DiskSpaceRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_DiskSpaceRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *DiskSpaceRequest) GetHeader() *RequestHeader {
|
||||||
|
if m != nil {
|
||||||
|
return m.Header
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DiskSpaceResponse struct {
|
||||||
|
Allocated int64 `protobuf:"varint,1,opt,name=allocated,proto3" json:"allocated,omitempty"`
|
||||||
|
UsedPieces int64 `protobuf:"varint,2,opt,name=used_pieces,json=usedPieces,proto3" json:"used_pieces,omitempty"`
|
||||||
|
UsedTrash int64 `protobuf:"varint,3,opt,name=used_trash,json=usedTrash,proto3" json:"used_trash,omitempty"`
|
||||||
|
Free int64 `protobuf:"varint,4,opt,name=free,proto3" json:"free,omitempty"`
|
||||||
|
Available int64 `protobuf:"varint,5,opt,name=available,proto3" json:"available,omitempty"`
|
||||||
|
Overused int64 `protobuf:"varint,6,opt,name=overused,proto3" json:"overused,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DiskSpaceResponse) Reset() { *m = DiskSpaceResponse{} }
|
||||||
|
func (m *DiskSpaceResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*DiskSpaceResponse) ProtoMessage() {}
|
||||||
|
func (*DiskSpaceResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{2}
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_DiskSpaceResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_DiskSpaceResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_DiskSpaceResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_DiskSpaceResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *DiskSpaceResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_DiskSpaceResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_DiskSpaceResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *DiskSpaceResponse) GetAllocated() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Allocated
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DiskSpaceResponse) GetUsedPieces() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.UsedPieces
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DiskSpaceResponse) GetUsedTrash() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.UsedTrash
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DiskSpaceResponse) GetFree() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Free
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DiskSpaceResponse) GetAvailable() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Available
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DiskSpaceResponse) GetOverused() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Overused
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type BandwidthMonthSummaryRequest struct {
|
||||||
|
Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *BandwidthMonthSummaryRequest) Reset() { *m = BandwidthMonthSummaryRequest{} }
|
||||||
|
func (m *BandwidthMonthSummaryRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*BandwidthMonthSummaryRequest) ProtoMessage() {}
|
||||||
|
func (*BandwidthMonthSummaryRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{3}
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_BandwidthMonthSummaryRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_BandwidthMonthSummaryRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_BandwidthMonthSummaryRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_BandwidthMonthSummaryRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_BandwidthMonthSummaryRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_BandwidthMonthSummaryRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *BandwidthMonthSummaryRequest) GetHeader() *RequestHeader {
|
||||||
|
if m != nil {
|
||||||
|
return m.Header
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type BandwidthMonthSummaryResponse struct {
|
||||||
|
Used int64 `protobuf:"varint,1,opt,name=used,proto3" json:"used,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *BandwidthMonthSummaryResponse) Reset() { *m = BandwidthMonthSummaryResponse{} }
|
||||||
|
func (m *BandwidthMonthSummaryResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*BandwidthMonthSummaryResponse) ProtoMessage() {}
|
||||||
|
func (*BandwidthMonthSummaryResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{4}
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_BandwidthMonthSummaryResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_BandwidthMonthSummaryResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_BandwidthMonthSummaryResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_BandwidthMonthSummaryResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *BandwidthMonthSummaryResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_BandwidthMonthSummaryResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_BandwidthMonthSummaryResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *BandwidthMonthSummaryResponse) GetUsed() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Used
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type VersionRequest struct {
|
||||||
|
Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *VersionRequest) Reset() { *m = VersionRequest{} }
|
||||||
|
func (m *VersionRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*VersionRequest) ProtoMessage() {}
|
||||||
|
func (*VersionRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{5}
|
||||||
|
}
|
||||||
|
func (m *VersionRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_VersionRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *VersionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_VersionRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *VersionRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_VersionRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *VersionRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_VersionRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *VersionRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_VersionRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_VersionRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *VersionRequest) GetHeader() *RequestHeader {
|
||||||
|
if m != nil {
|
||||||
|
return m.Header
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type VersionResponse struct {
|
||||||
|
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *VersionResponse) Reset() { *m = VersionResponse{} }
|
||||||
|
func (m *VersionResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*VersionResponse) ProtoMessage() {}
|
||||||
|
func (*VersionResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{6}
|
||||||
|
}
|
||||||
|
func (m *VersionResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_VersionResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *VersionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_VersionResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *VersionResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_VersionResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *VersionResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_VersionResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *VersionResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_VersionResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_VersionResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *VersionResponse) GetVersion() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Version
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type LastContactRequest struct {
|
||||||
|
Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *LastContactRequest) Reset() { *m = LastContactRequest{} }
|
||||||
|
func (m *LastContactRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*LastContactRequest) ProtoMessage() {}
|
||||||
|
func (*LastContactRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{7}
|
||||||
|
}
|
||||||
|
func (m *LastContactRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_LastContactRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *LastContactRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_LastContactRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *LastContactRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_LastContactRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *LastContactRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_LastContactRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *LastContactRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_LastContactRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_LastContactRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *LastContactRequest) GetHeader() *RequestHeader {
|
||||||
|
if m != nil {
|
||||||
|
return m.Header
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type LastContactResponse struct {
|
||||||
|
LastContact time.Time `protobuf:"bytes,1,opt,name=last_contact,json=lastContact,proto3,stdtime" json:"last_contact"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *LastContactResponse) Reset() { *m = LastContactResponse{} }
|
||||||
|
func (m *LastContactResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*LastContactResponse) ProtoMessage() {}
|
||||||
|
func (*LastContactResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_9a45fd79b06f3a1b, []int{8}
|
||||||
|
}
|
||||||
|
func (m *LastContactResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_LastContactResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *LastContactResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_LastContactResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *LastContactResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_LastContactResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *LastContactResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_LastContactResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *LastContactResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_LastContactResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_LastContactResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *LastContactResponse) GetLastContact() time.Time {
|
||||||
|
if m != nil {
|
||||||
|
return m.LastContact
|
||||||
|
}
|
||||||
|
return time.Time{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterType((*RequestHeader)(nil), "multinode.RequestHeader")
|
||||||
|
proto.RegisterType((*DiskSpaceRequest)(nil), "multinode.DiskSpaceRequest")
|
||||||
|
proto.RegisterType((*DiskSpaceResponse)(nil), "multinode.DiskSpaceResponse")
|
||||||
|
proto.RegisterType((*BandwidthMonthSummaryRequest)(nil), "multinode.BandwidthMonthSummaryRequest")
|
||||||
|
proto.RegisterType((*BandwidthMonthSummaryResponse)(nil), "multinode.BandwidthMonthSummaryResponse")
|
||||||
|
proto.RegisterType((*VersionRequest)(nil), "multinode.VersionRequest")
|
||||||
|
proto.RegisterType((*VersionResponse)(nil), "multinode.VersionResponse")
|
||||||
|
proto.RegisterType((*LastContactRequest)(nil), "multinode.LastContactRequest")
|
||||||
|
proto.RegisterType((*LastContactResponse)(nil), "multinode.LastContactResponse")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("multinode.proto", fileDescriptor_9a45fd79b06f3a1b) }
|
||||||
|
|
||||||
|
var fileDescriptor_9a45fd79b06f3a1b = []byte{
|
||||||
|
// 514 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xc1, 0x6e, 0xd3, 0x40,
|
||||||
|
0x10, 0x25, 0x34, 0x24, 0xf5, 0x24, 0x50, 0x58, 0x0e, 0x18, 0x93, 0x10, 0x64, 0x21, 0x11, 0x09,
|
||||||
|
0xc9, 0x46, 0xe9, 0x0f, 0xa0, 0x50, 0x15, 0x24, 0x0a, 0x2a, 0x4e, 0xc5, 0x81, 0x03, 0xd1, 0xc6,
|
||||||
|
0x9e, 0x3a, 0x4b, 0x6d, 0xaf, 0xd9, 0x5d, 0x07, 0xe5, 0x2f, 0x38, 0xf1, 0x3b, 0x5c, 0xf9, 0x0a,
|
||||||
|
0xf8, 0x15, 0x94, 0xf5, 0xc6, 0x71, 0xa0, 0x05, 0x29, 0xb7, 0x99, 0x37, 0x33, 0xef, 0x8d, 0x66,
|
||||||
|
0x1e, 0x1c, 0xa4, 0x45, 0xa2, 0x58, 0xc6, 0x23, 0xf4, 0x72, 0xc1, 0x15, 0x27, 0x56, 0x05, 0x38,
|
||||||
|
0x10, 0xf3, 0x98, 0x97, 0xb0, 0x33, 0x88, 0x39, 0x8f, 0x13, 0xf4, 0x75, 0x36, 0x2b, 0xce, 0x7d,
|
||||||
|
0xc5, 0x52, 0x94, 0x8a, 0xa6, 0x79, 0xd9, 0xe0, 0x0e, 0xe1, 0x66, 0x80, 0x9f, 0x0b, 0x94, 0xea,
|
||||||
|
0x15, 0xd2, 0x08, 0x05, 0xb9, 0x07, 0x6d, 0x9a, 0xb3, 0xe9, 0x05, 0x2e, 0xed, 0xc6, 0xa3, 0xc6,
|
||||||
|
0xb0, 0x1b, 0xb4, 0x68, 0xce, 0x5e, 0xe3, 0xd2, 0x3d, 0x82, 0xdb, 0x47, 0x4c, 0x5e, 0x4c, 0x72,
|
||||||
|
0x1a, 0xa2, 0x19, 0x21, 0xcf, 0xa0, 0x35, 0xd7, 0x63, 0xba, 0xb7, 0x33, 0xb2, 0xbd, 0xcd, 0x5e,
|
||||||
|
0x5b, 0xb4, 0x81, 0xe9, 0x73, 0xbf, 0x37, 0xe0, 0x4e, 0x8d, 0x46, 0xe6, 0x3c, 0x93, 0x48, 0x7a,
|
||||||
|
0x60, 0xd1, 0x24, 0xe1, 0x21, 0x55, 0x18, 0x69, 0xaa, 0xbd, 0x60, 0x03, 0x90, 0x01, 0x74, 0x0a,
|
||||||
|
0x89, 0xd1, 0x34, 0x67, 0x18, 0xa2, 0xb4, 0xaf, 0xeb, 0x3a, 0xac, 0xa0, 0x53, 0x8d, 0x90, 0x3e,
|
||||||
|
0xe8, 0x6c, 0xaa, 0x04, 0x95, 0x73, 0x7b, 0xaf, 0x9c, 0x5f, 0x21, 0x67, 0x2b, 0x80, 0x10, 0x68,
|
||||||
|
0x9e, 0x0b, 0x44, 0xbb, 0xa9, 0x0b, 0x3a, 0xd6, 0x8a, 0x0b, 0xca, 0x12, 0x3a, 0x4b, 0xd0, 0xbe,
|
||||||
|
0x61, 0x14, 0xd7, 0x00, 0x71, 0x60, 0x9f, 0x2f, 0x50, 0xac, 0x28, 0xec, 0x96, 0x2e, 0x56, 0xb9,
|
||||||
|
0x7b, 0x0a, 0xbd, 0x31, 0xcd, 0xa2, 0x2f, 0x2c, 0x52, 0xf3, 0x37, 0x3c, 0x53, 0xf3, 0x49, 0x91,
|
||||||
|
0xa6, 0x54, 0x2c, 0x77, 0xbf, 0xc9, 0x21, 0xf4, 0xaf, 0x60, 0x34, 0xe7, 0x21, 0xd0, 0xd4, 0xab,
|
||||||
|
0x94, 0x97, 0xd1, 0xb1, 0x3b, 0x86, 0x5b, 0xef, 0x51, 0x48, 0xc6, 0xb3, 0xdd, 0x85, 0x9f, 0xc2,
|
||||||
|
0x41, 0xc5, 0x61, 0xa4, 0x6c, 0x68, 0x2f, 0x4a, 0x48, 0xb3, 0x58, 0xc1, 0x3a, 0x75, 0x8f, 0x81,
|
||||||
|
0x9c, 0x50, 0xa9, 0x5e, 0xf0, 0x4c, 0xd1, 0x50, 0xed, 0x2e, 0xfa, 0x11, 0xee, 0x6e, 0xf1, 0x18,
|
||||||
|
0xe1, 0x97, 0xd0, 0x4d, 0xa8, 0x54, 0xd3, 0xb0, 0xc4, 0x0d, 0x9d, 0xe3, 0x95, 0x06, 0xf6, 0xd6,
|
||||||
|
0x06, 0xf6, 0xce, 0xd6, 0x06, 0x1e, 0xef, 0xff, 0xf8, 0x39, 0xb8, 0xf6, 0xf5, 0xd7, 0xa0, 0x11,
|
||||||
|
0x74, 0x92, 0x0d, 0xe1, 0xe8, 0x1d, 0xb4, 0x27, 0x8a, 0x0b, 0x1a, 0x23, 0x39, 0x06, 0xab, 0xf2,
|
||||||
|
0x1a, 0x79, 0x50, 0xdb, 0xec, 0x4f, 0x23, 0x3b, 0xbd, 0xcb, 0x8b, 0xe5, 0x6e, 0xa3, 0x0c, 0xac,
|
||||||
|
0xea, 0x41, 0x84, 0x42, 0xb7, 0xfe, 0x24, 0xf2, 0xa4, 0x36, 0xfa, 0x2f, 0x63, 0x38, 0xc3, 0xff,
|
||||||
|
0x37, 0x1a, 0xbd, 0x6f, 0x0d, 0x68, 0xbe, 0xe5, 0x11, 0x92, 0xe7, 0xd0, 0x36, 0x0f, 0x22, 0xf7,
|
||||||
|
0x6b, 0xd3, 0xdb, 0x8f, 0x77, 0x9c, 0xcb, 0x4a, 0xe6, 0xac, 0x27, 0xd0, 0xa9, 0x5d, 0x9b, 0xf4,
|
||||||
|
0x6b, 0xad, 0x7f, 0x7f, 0xd3, 0x79, 0x78, 0x55, 0xb9, 0x64, 0x1b, 0x3f, 0xfe, 0xe0, 0x4a, 0xc5,
|
||||||
|
0xc5, 0x27, 0x8f, 0x71, 0x5f, 0x07, 0x7e, 0x2e, 0xd8, 0x82, 0x2a, 0xf4, 0xab, 0xb9, 0x7c, 0x36,
|
||||||
|
0x6b, 0xe9, 0x67, 0x1d, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x70, 0xf2, 0x78, 0x97, 0xa5, 0x04,
|
||||||
|
0x00, 0x00,
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- DRPC BEGIN ---
|
||||||
|
|
||||||
|
type DRPCStorageClient interface {
|
||||||
|
DRPCConn() drpc.Conn
|
||||||
|
|
||||||
|
DiskSpace(ctx context.Context, in *DiskSpaceRequest) (*DiskSpaceResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcStorageClient struct {
|
||||||
|
cc drpc.Conn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDRPCStorageClient(cc drpc.Conn) DRPCStorageClient {
|
||||||
|
return &drpcStorageClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcStorageClient) DRPCConn() drpc.Conn { return c.cc }
|
||||||
|
|
||||||
|
func (c *drpcStorageClient) DiskSpace(ctx context.Context, in *DiskSpaceRequest) (*DiskSpaceResponse, error) {
|
||||||
|
out := new(DiskSpaceResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/multinode.Storage/DiskSpace", in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCStorageServer interface {
|
||||||
|
DiskSpace(context.Context, *DiskSpaceRequest) (*DiskSpaceResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCStorageDescription struct{}
|
||||||
|
|
||||||
|
func (DRPCStorageDescription) NumMethods() int { return 1 }
|
||||||
|
|
||||||
|
func (DRPCStorageDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) {
|
||||||
|
switch n {
|
||||||
|
case 0:
|
||||||
|
return "/multinode.Storage/DiskSpace",
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCStorageServer).
|
||||||
|
DiskSpace(
|
||||||
|
ctx,
|
||||||
|
in1.(*DiskSpaceRequest),
|
||||||
|
)
|
||||||
|
}, DRPCStorageServer.DiskSpace, true
|
||||||
|
default:
|
||||||
|
return "", nil, nil, false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DRPCRegisterStorage(mux drpc.Mux, impl DRPCStorageServer) error {
|
||||||
|
return mux.Register(impl, DRPCStorageDescription{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCStorage_DiskSpaceStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*DiskSpaceResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcStorageDiskSpaceStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcStorageDiskSpaceStream) SendAndClose(m *DiskSpaceResponse) error {
|
||||||
|
if err := x.MsgSend(m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCBandwidthClient interface {
|
||||||
|
DRPCConn() drpc.Conn
|
||||||
|
|
||||||
|
MonthSummary(ctx context.Context, in *BandwidthMonthSummaryRequest) (*BandwidthMonthSummaryResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcBandwidthClient struct {
|
||||||
|
cc drpc.Conn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDRPCBandwidthClient(cc drpc.Conn) DRPCBandwidthClient {
|
||||||
|
return &drpcBandwidthClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcBandwidthClient) DRPCConn() drpc.Conn { return c.cc }
|
||||||
|
|
||||||
|
func (c *drpcBandwidthClient) MonthSummary(ctx context.Context, in *BandwidthMonthSummaryRequest) (*BandwidthMonthSummaryResponse, error) {
|
||||||
|
out := new(BandwidthMonthSummaryResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/multinode.Bandwidth/MonthSummary", in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCBandwidthServer interface {
|
||||||
|
MonthSummary(context.Context, *BandwidthMonthSummaryRequest) (*BandwidthMonthSummaryResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCBandwidthDescription struct{}
|
||||||
|
|
||||||
|
func (DRPCBandwidthDescription) NumMethods() int { return 1 }
|
||||||
|
|
||||||
|
func (DRPCBandwidthDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) {
|
||||||
|
switch n {
|
||||||
|
case 0:
|
||||||
|
return "/multinode.Bandwidth/MonthSummary",
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCBandwidthServer).
|
||||||
|
MonthSummary(
|
||||||
|
ctx,
|
||||||
|
in1.(*BandwidthMonthSummaryRequest),
|
||||||
|
)
|
||||||
|
}, DRPCBandwidthServer.MonthSummary, true
|
||||||
|
default:
|
||||||
|
return "", nil, nil, false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DRPCRegisterBandwidth(mux drpc.Mux, impl DRPCBandwidthServer) error {
|
||||||
|
return mux.Register(impl, DRPCBandwidthDescription{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCBandwidth_MonthSummaryStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*BandwidthMonthSummaryResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcBandwidthMonthSummaryStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcBandwidthMonthSummaryStream) SendAndClose(m *BandwidthMonthSummaryResponse) error {
|
||||||
|
if err := x.MsgSend(m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCNodeClient interface {
|
||||||
|
DRPCConn() drpc.Conn
|
||||||
|
|
||||||
|
Version(ctx context.Context, in *VersionRequest) (*VersionResponse, error)
|
||||||
|
LastContact(ctx context.Context, in *LastContactRequest) (*LastContactResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcNodeClient struct {
|
||||||
|
cc drpc.Conn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDRPCNodeClient(cc drpc.Conn) DRPCNodeClient {
|
||||||
|
return &drpcNodeClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcNodeClient) DRPCConn() drpc.Conn { return c.cc }
|
||||||
|
|
||||||
|
func (c *drpcNodeClient) Version(ctx context.Context, in *VersionRequest) (*VersionResponse, error) {
|
||||||
|
out := new(VersionResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/multinode.Node/Version", in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *drpcNodeClient) LastContact(ctx context.Context, in *LastContactRequest) (*LastContactResponse, error) {
|
||||||
|
out := new(LastContactResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/multinode.Node/LastContact", in, out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCNodeServer interface {
|
||||||
|
Version(context.Context, *VersionRequest) (*VersionResponse, error)
|
||||||
|
LastContact(context.Context, *LastContactRequest) (*LastContactResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCNodeDescription struct{}
|
||||||
|
|
||||||
|
func (DRPCNodeDescription) NumMethods() int { return 2 }
|
||||||
|
|
||||||
|
func (DRPCNodeDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) {
|
||||||
|
switch n {
|
||||||
|
case 0:
|
||||||
|
return "/multinode.Node/Version",
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCNodeServer).
|
||||||
|
Version(
|
||||||
|
ctx,
|
||||||
|
in1.(*VersionRequest),
|
||||||
|
)
|
||||||
|
}, DRPCNodeServer.Version, true
|
||||||
|
case 1:
|
||||||
|
return "/multinode.Node/LastContact",
|
||||||
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||||
|
return srv.(DRPCNodeServer).
|
||||||
|
LastContact(
|
||||||
|
ctx,
|
||||||
|
in1.(*LastContactRequest),
|
||||||
|
)
|
||||||
|
}, DRPCNodeServer.LastContact, true
|
||||||
|
default:
|
||||||
|
return "", nil, nil, false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DRPCRegisterNode(mux drpc.Mux, impl DRPCNodeServer) error {
|
||||||
|
return mux.Register(impl, DRPCNodeDescription{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCNode_VersionStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*VersionResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcNodeVersionStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcNodeVersionStream) SendAndClose(m *VersionResponse) error {
|
||||||
|
if err := x.MsgSend(m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
type DRPCNode_LastContactStream interface {
|
||||||
|
drpc.Stream
|
||||||
|
SendAndClose(*LastContactResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type drpcNodeLastContactStream struct {
|
||||||
|
drpc.Stream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *drpcNodeLastContactStream) SendAndClose(m *LastContactResponse) error {
|
||||||
|
if err := x.MsgSend(m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return x.CloseSend()
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- DRPC END ---
|
64
private/multinodepb/multinode.proto
Normal file
64
private/multinodepb/multinode.proto
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// Copyright (C) 2020 Storj Labs, Inc.
|
||||||
|
// See LICENSE for copying information.
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
option go_package = "storj.io/storj/private/multinodepb";
|
||||||
|
|
||||||
|
package multinode;
|
||||||
|
|
||||||
|
import "gogo.proto";
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
|
message RequestHeader {
|
||||||
|
bytes api_key = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
service Storage {
|
||||||
|
rpc DiskSpace(DiskSpaceRequest) returns (DiskSpaceResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message DiskSpaceRequest {
|
||||||
|
RequestHeader header = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DiskSpaceResponse {
|
||||||
|
int64 allocated = 1;
|
||||||
|
int64 used_pieces = 2;
|
||||||
|
int64 used_trash = 3;
|
||||||
|
int64 free = 4;
|
||||||
|
int64 available = 5;
|
||||||
|
int64 overused = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
service Bandwidth {
|
||||||
|
rpc MonthSummary(BandwidthMonthSummaryRequest) returns (BandwidthMonthSummaryResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message BandwidthMonthSummaryRequest {
|
||||||
|
RequestHeader header = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BandwidthMonthSummaryResponse {
|
||||||
|
int64 used = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
service Node {
|
||||||
|
rpc Version(VersionRequest) returns (VersionResponse);
|
||||||
|
rpc LastContact(LastContactRequest) returns (LastContactResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message VersionRequest {
|
||||||
|
RequestHeader header = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message VersionResponse {
|
||||||
|
string version = 1; // must be semver formatted
|
||||||
|
}
|
||||||
|
|
||||||
|
message LastContactRequest {
|
||||||
|
RequestHeader header = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LastContactResponse {
|
||||||
|
google.protobuf.Timestamp last_contact = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
||||||
|
}
|
@ -4,78 +4,35 @@
|
|||||||
package apikeys
|
package apikeys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"crypto/rand"
|
|
||||||
"encoding/base64"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zeebo/errs"
|
"github.com/zeebo/errs"
|
||||||
|
|
||||||
|
"storj.io/storj/private/multinodeauth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrNoSecret represents errors from the apikey database.
|
// ErrNoAPIKey represents no api key error.
|
||||||
var ErrNoSecret = errs.Class("no apikey error")
|
var ErrNoAPIKey = errs.Class("no api key error")
|
||||||
|
|
||||||
// DB is interface for working with apikey tokens.
|
// DB is interface for working with api keys.
|
||||||
//
|
//
|
||||||
// architecture: Database
|
// architecture: Database
|
||||||
type DB interface {
|
type DB interface {
|
||||||
// Store stores apikey token into db.
|
// Store stores api key into db.
|
||||||
Store(ctx context.Context, secret APIKey) error
|
Store(ctx context.Context, apiKey APIKey) error
|
||||||
|
|
||||||
// Check checks if unique apikey exists in db by token.
|
// Check checks if api key exists in db by secret.
|
||||||
Check(ctx context.Context, token Secret) error
|
Check(ctx context.Context, secret multinodeauth.Secret) error
|
||||||
|
|
||||||
// Revoke removes token from db.
|
// Revoke removes api key from db.
|
||||||
Revoke(ctx context.Context, token Secret) error
|
Revoke(ctx context.Context, secret multinodeauth.Secret) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Secret stores token of storagenode APIkey.
|
// APIKey describing api key in the database.
|
||||||
type Secret [32]byte
|
|
||||||
|
|
||||||
// APIKey describing apikey model in the database.
|
|
||||||
type APIKey struct {
|
type APIKey struct {
|
||||||
// Secret is PK of the table and keeps unique value sno apikey token
|
// APIKeys is PK of the table and keeps unique value sno api key.
|
||||||
Secret Secret
|
Secret multinodeauth.Secret
|
||||||
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSecret creates new apikey secret.
|
|
||||||
func NewSecret() (Secret, error) {
|
|
||||||
var b [32]byte
|
|
||||||
|
|
||||||
_, err := rand.Read(b[:])
|
|
||||||
if err != nil {
|
|
||||||
return b, errs.New("error creating apikey token")
|
|
||||||
}
|
|
||||||
|
|
||||||
return b, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// String implements Stringer.
|
|
||||||
func (secret Secret) String() string {
|
|
||||||
return base64.URLEncoding.EncodeToString(secret[:])
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsZero returns if the apikey token is not set.
|
|
||||||
func (secret Secret) IsZero() bool {
|
|
||||||
var zero Secret
|
|
||||||
// this doesn't need to be constant-time, because we're explicitly testing
|
|
||||||
// against a hardcoded, well-known value
|
|
||||||
return bytes.Equal(secret[:], zero[:])
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenSecretFromBase64 creates new apikey token from base64 string.
|
|
||||||
func TokenSecretFromBase64(s string) (Secret, error) {
|
|
||||||
var token Secret
|
|
||||||
|
|
||||||
b, err := base64.URLEncoding.DecodeString(s)
|
|
||||||
if err != nil {
|
|
||||||
return token, err
|
|
||||||
}
|
|
||||||
|
|
||||||
copy(token[:], b)
|
|
||||||
|
|
||||||
return token, nil
|
|
||||||
}
|
|
||||||
|
@ -10,42 +10,42 @@ import (
|
|||||||
"github.com/zeebo/assert"
|
"github.com/zeebo/assert"
|
||||||
|
|
||||||
"storj.io/common/testcontext"
|
"storj.io/common/testcontext"
|
||||||
|
"storj.io/storj/private/multinodeauth"
|
||||||
"storj.io/storj/storagenode"
|
"storj.io/storj/storagenode"
|
||||||
"storj.io/storj/storagenode/apikeys"
|
"storj.io/storj/storagenode/apikeys"
|
||||||
"storj.io/storj/storagenode/storagenodedb/storagenodedbtest"
|
"storj.io/storj/storagenode/storagenodedb/storagenodedbtest"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSecretDB(t *testing.T) {
|
func TestAPIKeysDB(t *testing.T) {
|
||||||
storagenodedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db storagenode.DB) {
|
storagenodedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db storagenode.DB) {
|
||||||
secrets := db.Secret()
|
apiKeys := db.APIKeys()
|
||||||
token, err := apikeys.NewSecret()
|
secret, err := multinodeauth.NewSecret()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
token2, err := apikeys.NewSecret()
|
secret2, err := multinodeauth.NewSecret()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
t.Run("Test StoreSecret", func(t *testing.T) {
|
t.Run("Store", func(t *testing.T) {
|
||||||
err := secrets.Store(ctx, apikeys.APIKey{
|
err := apiKeys.Store(ctx, apikeys.APIKey{
|
||||||
Secret: token,
|
Secret: secret,
|
||||||
CreatedAt: time.Now().UTC(),
|
CreatedAt: time.Now().UTC(),
|
||||||
})
|
})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Test CheckSecret", func(t *testing.T) {
|
t.Run("Check", func(t *testing.T) {
|
||||||
err := secrets.Check(ctx, token)
|
err := apiKeys.Check(ctx, secret)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
err = secrets.Check(ctx, token2)
|
err = apiKeys.Check(ctx, secret2)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Test RevokeSecret", func(t *testing.T) {
|
t.Run("Revoke", func(t *testing.T) {
|
||||||
err = secrets.Revoke(ctx, token)
|
err = apiKeys.Revoke(ctx, secret)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
err = secrets.Check(ctx, token)
|
err = apiKeys.Check(ctx, secret)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/spacemonkeygo/monkit/v3"
|
"github.com/spacemonkeygo/monkit/v3"
|
||||||
"github.com/zeebo/errs"
|
"github.com/zeebo/errs"
|
||||||
|
|
||||||
|
"storj.io/storj/private/multinodeauth"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -33,7 +35,7 @@ func NewService(db DB) *Service {
|
|||||||
// Issue generates new api key and stores it into db.
|
// Issue generates new api key and stores it into db.
|
||||||
func (service *Service) Issue(ctx context.Context) (apiKey APIKey, err error) {
|
func (service *Service) Issue(ctx context.Context) (apiKey APIKey, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
secret, err := NewSecret()
|
secret, err := multinodeauth.NewSecret()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return APIKey{}, ErrService.Wrap(err)
|
return APIKey{}, ErrService.Wrap(err)
|
||||||
}
|
}
|
||||||
@ -50,14 +52,14 @@ func (service *Service) Issue(ctx context.Context) (apiKey APIKey, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check returns error if api key does not exists.
|
// Check returns error if api key does not exists.
|
||||||
func (service *Service) Check(ctx context.Context, secret Secret) (err error) {
|
func (service *Service) Check(ctx context.Context, secret multinodeauth.Secret) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
return service.store.Check(ctx, secret)
|
return service.store.Check(ctx, secret)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove revokes apikey, deletes it from db.
|
// Remove revokes apikey, deletes it from db.
|
||||||
func (service *Service) Remove(ctx context.Context, secret Secret) (err error) {
|
func (service *Service) Remove(ctx context.Context, secret multinodeauth.Secret) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
return ErrService.Wrap(service.store.Revoke(ctx, secret))
|
return ErrService.Wrap(service.store.Revoke(ctx, secret))
|
||||||
|
@ -27,6 +27,16 @@ var (
|
|||||||
Error = errs.Class("piecestore monitor")
|
Error = errs.Class("piecestore monitor")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DiskSpace consolidates monitored disk space statistics.
|
||||||
|
type DiskSpace struct {
|
||||||
|
Allocated int64
|
||||||
|
UsedForPieces int64
|
||||||
|
UsedForTrash int64
|
||||||
|
Free int64
|
||||||
|
Available int64
|
||||||
|
Overused int64
|
||||||
|
}
|
||||||
|
|
||||||
// Config defines parameters for storage node disk and bandwidth usage monitoring.
|
// Config defines parameters for storage node disk and bandwidth usage monitoring.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Interval time.Duration `help:"how frequently Kademlia bucket should be refreshed with node stats" default:"1h0m0s"`
|
Interval time.Duration `help:"how frequently Kademlia bucket should be refreshed with node stats" default:"1h0m0s"`
|
||||||
@ -81,9 +91,9 @@ func (service *Service) Run(ctx context.Context) (err error) {
|
|||||||
}
|
}
|
||||||
freeDiskSpace := storageStatus.DiskFree
|
freeDiskSpace := storageStatus.DiskFree
|
||||||
|
|
||||||
totalUsed, err := service.usedSpace(ctx)
|
totalUsed, err := service.store.SpaceUsedForPiecesAndTrash(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return Error.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check your hard drive is big enough
|
// check your hard drive is big enough
|
||||||
@ -184,21 +194,13 @@ func (service *Service) updateNodeInformation(ctx context.Context) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (service *Service) usedSpace(ctx context.Context) (_ int64, err error) {
|
|
||||||
defer mon.Task()(&ctx)(&err)
|
|
||||||
usedSpace, err := service.store.SpaceUsedForPiecesAndTrash(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return usedSpace, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// AvailableSpace returns available disk space for upload.
|
// AvailableSpace returns available disk space for upload.
|
||||||
func (service *Service) AvailableSpace(ctx context.Context) (_ int64, err error) {
|
func (service *Service) AvailableSpace(ctx context.Context) (_ int64, err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
usedSpace, err := service.usedSpace(ctx)
|
|
||||||
|
usedSpace, err := service.store.SpaceUsedForPiecesAndTrash(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, Error.Wrap(err)
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
freeSpaceForStorj := service.allocatedDiskSpace - usedSpace
|
freeSpaceForStorj := service.allocatedDiskSpace - usedSpace
|
||||||
@ -217,3 +219,41 @@ func (service *Service) AvailableSpace(ctx context.Context) (_ int64, err error)
|
|||||||
|
|
||||||
return freeSpaceForStorj, nil
|
return freeSpaceForStorj, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DiskSpace returns consolidated disk space state info.
|
||||||
|
func (service *Service) DiskSpace(ctx context.Context) (_ DiskSpace, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
usedForPieces, _, err := service.store.SpaceUsedForPieces(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return DiskSpace{}, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
usedForTrash, err := service.store.SpaceUsedForTrash(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return DiskSpace{}, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
storageStatus, err := service.store.StorageStatus(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return DiskSpace{}, Error.Wrap(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
overused := int64(0)
|
||||||
|
|
||||||
|
available := service.allocatedDiskSpace - (usedForPieces + usedForTrash)
|
||||||
|
if available < 0 {
|
||||||
|
overused = -available
|
||||||
|
}
|
||||||
|
if storageStatus.DiskFree < available {
|
||||||
|
available = storageStatus.DiskFree
|
||||||
|
}
|
||||||
|
|
||||||
|
return DiskSpace{
|
||||||
|
Allocated: service.allocatedDiskSpace,
|
||||||
|
UsedForPieces: usedForPieces,
|
||||||
|
UsedForTrash: usedForTrash,
|
||||||
|
Free: storageStatus.DiskFree,
|
||||||
|
Available: available,
|
||||||
|
Overused: overused,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
26
storagenode/multinode/auth.go
Normal file
26
storagenode/multinode/auth.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (C) 2020 Storj Labs, Inc.
|
||||||
|
// See LICENSE for copying information.
|
||||||
|
|
||||||
|
package multinode
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"storj.io/storj/private/multinodeauth"
|
||||||
|
"storj.io/storj/private/multinodepb"
|
||||||
|
"storj.io/storj/storagenode/apikeys"
|
||||||
|
)
|
||||||
|
|
||||||
|
// authenticate checks if request header contains valid api key.
|
||||||
|
func authenticate(ctx context.Context, apiKeys *apikeys.Service, header *multinodepb.RequestHeader) error {
|
||||||
|
secret, err := multinodeauth.SecretFromBytes(header.GetApiKey())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = apiKeys.Check(ctx, secret); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
54
storagenode/multinode/bandwidth.go
Normal file
54
storagenode/multinode/bandwidth.go
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// Copyright (C) 2020 Storj Labs, Inc.
|
||||||
|
// See LICENSE for copying information.
|
||||||
|
|
||||||
|
package multinode
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"storj.io/common/rpc/rpcstatus"
|
||||||
|
"storj.io/storj/private/multinodepb"
|
||||||
|
"storj.io/storj/storagenode/apikeys"
|
||||||
|
"storj.io/storj/storagenode/bandwidth"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ multinodepb.DRPCBandwidthServer = (*BandwidthEndpoint)(nil)
|
||||||
|
|
||||||
|
// BandwidthEndpoint implements multinode bandwidth endpoint.
|
||||||
|
//
|
||||||
|
// architecture: Endpoint
|
||||||
|
type BandwidthEndpoint struct {
|
||||||
|
log *zap.Logger
|
||||||
|
apiKeys *apikeys.Service
|
||||||
|
db bandwidth.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewBandwidthEndpoint creates new multinode bandwidth endpoint.
|
||||||
|
func NewBandwidthEndpoint(log *zap.Logger, apiKeys *apikeys.Service, db bandwidth.DB) *BandwidthEndpoint {
|
||||||
|
return &BandwidthEndpoint{
|
||||||
|
log: log,
|
||||||
|
apiKeys: apiKeys,
|
||||||
|
db: db,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MonthSummary returns bandwidth used current month.
|
||||||
|
func (bandwidth *BandwidthEndpoint) MonthSummary(ctx context.Context, req *multinodepb.BandwidthMonthSummaryRequest) (_ *multinodepb.BandwidthMonthSummaryResponse, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
if err = authenticate(ctx, bandwidth.apiKeys, req.GetHeader()); err != nil {
|
||||||
|
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
used, err := bandwidth.db.MonthSummary(ctx, time.Now())
|
||||||
|
if err != nil {
|
||||||
|
return nil, rpcstatus.Wrap(rpcstatus.Internal, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &multinodepb.BandwidthMonthSummaryResponse{
|
||||||
|
Used: used,
|
||||||
|
}, nil
|
||||||
|
}
|
12
storagenode/multinode/common.go
Normal file
12
storagenode/multinode/common.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright (C) 2020 Storj Labs, Inc.
|
||||||
|
// See LICENSE for copying information.
|
||||||
|
|
||||||
|
package multinode
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spacemonkeygo/monkit/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
mon = monkit.Package()
|
||||||
|
)
|
64
storagenode/multinode/node.go
Normal file
64
storagenode/multinode/node.go
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// Copyright (C) 2020 Storj Labs, Inc.
|
||||||
|
// See LICENSE for copying information.
|
||||||
|
|
||||||
|
package multinode
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"storj.io/common/rpc/rpcstatus"
|
||||||
|
"storj.io/private/version"
|
||||||
|
"storj.io/storj/private/multinodepb"
|
||||||
|
"storj.io/storj/storagenode/apikeys"
|
||||||
|
"storj.io/storj/storagenode/contact"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ multinodepb.DRPCNodeServer = (*NodeEndpoint)(nil)
|
||||||
|
|
||||||
|
// NodeEndpoint implements multinode node endpoint.
|
||||||
|
//
|
||||||
|
// architecture: Endpoint
|
||||||
|
type NodeEndpoint struct {
|
||||||
|
log *zap.Logger
|
||||||
|
apiKeys *apikeys.Service
|
||||||
|
version version.Info
|
||||||
|
contact *contact.PingStats
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewNodeEndpoint creates new multinode node endpoint.
|
||||||
|
func NewNodeEndpoint(log *zap.Logger, apiKeys *apikeys.Service, version version.Info, contact *contact.PingStats) *NodeEndpoint {
|
||||||
|
return &NodeEndpoint{
|
||||||
|
log: log,
|
||||||
|
apiKeys: apiKeys,
|
||||||
|
version: version,
|
||||||
|
contact: contact,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Version returns node current version.
|
||||||
|
func (node *NodeEndpoint) Version(ctx context.Context, req *multinodepb.VersionRequest) (_ *multinodepb.VersionResponse, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
if err = authenticate(ctx, node.apiKeys, req.GetHeader()); err != nil {
|
||||||
|
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &multinodepb.VersionResponse{
|
||||||
|
Version: node.version.Version.String(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// LastContact returns timestamp when node was last in contact with satellite.
|
||||||
|
func (node *NodeEndpoint) LastContact(ctx context.Context, req *multinodepb.LastContactRequest) (_ *multinodepb.LastContactResponse, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
if err = authenticate(ctx, node.apiKeys, req.GetHeader()); err != nil {
|
||||||
|
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &multinodepb.LastContactResponse{
|
||||||
|
LastContact: node.contact.WhenLastPinged(),
|
||||||
|
}, nil
|
||||||
|
}
|
59
storagenode/multinode/storage.go
Normal file
59
storagenode/multinode/storage.go
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// Copyright (C) 2020 Storj Labs, Inc.
|
||||||
|
// See LICENSE for copying information.
|
||||||
|
|
||||||
|
package multinode
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.uber.org/zap"
|
||||||
|
|
||||||
|
"storj.io/common/rpc/rpcstatus"
|
||||||
|
"storj.io/storj/private/multinodepb"
|
||||||
|
"storj.io/storj/storagenode/apikeys"
|
||||||
|
"storj.io/storj/storagenode/monitor"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ multinodepb.DRPCStorageServer = (*StorageEndpoint)(nil)
|
||||||
|
|
||||||
|
// StorageEndpoint implements multinode storage endpoint.
|
||||||
|
//
|
||||||
|
// architecture: Endpoint
|
||||||
|
type StorageEndpoint struct {
|
||||||
|
log *zap.Logger
|
||||||
|
apiKeys *apikeys.Service
|
||||||
|
monitor *monitor.Service
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewStorageEndpoint creates new multinode storage endpoint.
|
||||||
|
func NewStorageEndpoint(log *zap.Logger, apiKeys *apikeys.Service, monitor *monitor.Service) *StorageEndpoint {
|
||||||
|
return &StorageEndpoint{
|
||||||
|
log: log,
|
||||||
|
apiKeys: apiKeys,
|
||||||
|
monitor: monitor,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DiskSpace returns disk space state.
|
||||||
|
func (storage *StorageEndpoint) DiskSpace(ctx context.Context, req *multinodepb.DiskSpaceRequest) (_ *multinodepb.DiskSpaceResponse, err error) {
|
||||||
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
|
if err = authenticate(ctx, storage.apiKeys, req.GetHeader()); err != nil {
|
||||||
|
return nil, rpcstatus.Wrap(rpcstatus.Unauthenticated, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
diskSpace, err := storage.monitor.DiskSpace(ctx)
|
||||||
|
if err != nil {
|
||||||
|
storage.log.Error("disk space internal error", zap.Error(err))
|
||||||
|
return nil, rpcstatus.Wrap(rpcstatus.Internal, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &multinodepb.DiskSpaceResponse{
|
||||||
|
Allocated: diskSpace.Allocated,
|
||||||
|
UsedPieces: diskSpace.UsedForPieces,
|
||||||
|
UsedTrash: diskSpace.UsedForTrash,
|
||||||
|
Free: diskSpace.Free,
|
||||||
|
Available: diskSpace.Available,
|
||||||
|
Overused: diskSpace.Overused,
|
||||||
|
}, nil
|
||||||
|
}
|
@ -28,6 +28,7 @@ import (
|
|||||||
"storj.io/private/version"
|
"storj.io/private/version"
|
||||||
"storj.io/storj/pkg/server"
|
"storj.io/storj/pkg/server"
|
||||||
"storj.io/storj/private/lifecycle"
|
"storj.io/storj/private/lifecycle"
|
||||||
|
"storj.io/storj/private/multinodepb"
|
||||||
"storj.io/storj/private/version/checker"
|
"storj.io/storj/private/version/checker"
|
||||||
"storj.io/storj/storage"
|
"storj.io/storj/storage"
|
||||||
"storj.io/storj/storage/filestore"
|
"storj.io/storj/storage/filestore"
|
||||||
@ -42,6 +43,7 @@ import (
|
|||||||
"storj.io/storj/storagenode/inspector"
|
"storj.io/storj/storagenode/inspector"
|
||||||
"storj.io/storj/storagenode/internalpb"
|
"storj.io/storj/storagenode/internalpb"
|
||||||
"storj.io/storj/storagenode/monitor"
|
"storj.io/storj/storagenode/monitor"
|
||||||
|
"storj.io/storj/storagenode/multinode"
|
||||||
"storj.io/storj/storagenode/nodestats"
|
"storj.io/storj/storagenode/nodestats"
|
||||||
"storj.io/storj/storagenode/notifications"
|
"storj.io/storj/storagenode/notifications"
|
||||||
"storj.io/storj/storagenode/orders"
|
"storj.io/storj/storagenode/orders"
|
||||||
@ -88,7 +90,7 @@ type DB interface {
|
|||||||
Notifications() notifications.DB
|
Notifications() notifications.DB
|
||||||
Payout() payout.DB
|
Payout() payout.DB
|
||||||
Pricing() pricing.DB
|
Pricing() pricing.DB
|
||||||
Secret() apikeys.DB
|
APIKeys() apikeys.DB
|
||||||
|
|
||||||
Preflight(ctx context.Context) error
|
Preflight(ctx context.Context) error
|
||||||
}
|
}
|
||||||
@ -279,6 +281,12 @@ type Peer struct {
|
|||||||
Bandwidth *bandwidth.Service
|
Bandwidth *bandwidth.Service
|
||||||
|
|
||||||
Reputation *reputation.Service
|
Reputation *reputation.Service
|
||||||
|
|
||||||
|
Multinode struct {
|
||||||
|
Storage *multinode.StorageEndpoint
|
||||||
|
Bandwidth *multinode.BandwidthEndpoint
|
||||||
|
Node *multinode.NodeEndpoint
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new Storage Node.
|
// New creates a new Storage Node.
|
||||||
@ -769,6 +777,37 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten
|
|||||||
peer.Debug.Server.Panel.Add(
|
peer.Debug.Server.Panel.Add(
|
||||||
debug.Cycle("Bandwidth", peer.Bandwidth.Loop))
|
debug.Cycle("Bandwidth", peer.Bandwidth.Loop))
|
||||||
|
|
||||||
|
{ // setup multinode endpoints
|
||||||
|
// TODO: add to peer?
|
||||||
|
apiKeys := apikeys.NewService(peer.DB.APIKeys())
|
||||||
|
|
||||||
|
peer.Multinode.Storage = multinode.NewStorageEndpoint(
|
||||||
|
peer.Log.Named("multinode:storage-endpoint"),
|
||||||
|
apiKeys,
|
||||||
|
peer.Storage2.Monitor)
|
||||||
|
|
||||||
|
peer.Multinode.Bandwidth = multinode.NewBandwidthEndpoint(
|
||||||
|
peer.Log.Named("multinode:bandwidth-endpoint"),
|
||||||
|
apiKeys,
|
||||||
|
peer.DB.Bandwidth())
|
||||||
|
|
||||||
|
peer.Multinode.Node = multinode.NewNodeEndpoint(
|
||||||
|
peer.Log.Named("multinode:node-endpoint"),
|
||||||
|
apiKeys,
|
||||||
|
peer.Version.Service.Info,
|
||||||
|
peer.Contact.PingStats)
|
||||||
|
|
||||||
|
if err = multinodepb.DRPCRegisterStorage(peer.Server.DRPC(), peer.Multinode.Storage); err != nil {
|
||||||
|
return nil, errs.Combine(err, peer.Close())
|
||||||
|
}
|
||||||
|
if err = multinodepb.DRPCRegisterBandwidth(peer.Server.DRPC(), peer.Multinode.Bandwidth); err != nil {
|
||||||
|
return nil, errs.Combine(err, peer.Close())
|
||||||
|
}
|
||||||
|
if err = multinodepb.DRPCRegisterNode(peer.Server.DRPC(), peer.Multinode.Node); err != nil {
|
||||||
|
return nil, errs.Combine(err, peer.Close())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return peer, nil
|
return peer, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,25 +10,26 @@ import (
|
|||||||
|
|
||||||
"github.com/zeebo/errs"
|
"github.com/zeebo/errs"
|
||||||
|
|
||||||
|
"storj.io/storj/private/multinodeauth"
|
||||||
"storj.io/storj/storagenode/apikeys"
|
"storj.io/storj/storagenode/apikeys"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ensures that secretDB implements apikeys.DB interface.
|
// ensures that apiKeysDB implements apikeys.DB interface.
|
||||||
var _ apikeys.DB = (*secretDB)(nil)
|
var _ apikeys.DB = (*apiKeysDB)(nil)
|
||||||
|
|
||||||
// ErrSecret represents errors from the apikey database.
|
// ErrAPIKeysDB represents errors from the api keys database.
|
||||||
var ErrSecret = errs.Class("apikey db error")
|
var ErrAPIKeysDB = errs.Class("apikeys db error")
|
||||||
|
|
||||||
// SecretDBName represents the database name.
|
// APIKeysDBName represents the database name.
|
||||||
const SecretDBName = "secret"
|
const APIKeysDBName = "secret"
|
||||||
|
|
||||||
// secretDB works with node apikey DB.
|
// apiKeysDB works with node api keys DB.
|
||||||
type secretDB struct {
|
type apiKeysDB struct {
|
||||||
dbContainerImpl
|
dbContainerImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store stores apikey into database.
|
// Store stores api key into database.
|
||||||
func (db *secretDB) Store(ctx context.Context, secret apikeys.APIKey) (err error) {
|
func (db *apiKeysDB) Store(ctx context.Context, apiKey apikeys.APIKey) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
query := `INSERT INTO secret (
|
query := `INSERT INTO secret (
|
||||||
@ -37,15 +38,15 @@ func (db *secretDB) Store(ctx context.Context, secret apikeys.APIKey) (err error
|
|||||||
) VALUES(?,?)`
|
) VALUES(?,?)`
|
||||||
|
|
||||||
_, err = db.ExecContext(ctx, query,
|
_, err = db.ExecContext(ctx, query,
|
||||||
secret.Secret[:],
|
apiKey.Secret[:],
|
||||||
secret.CreatedAt,
|
apiKey.CreatedAt,
|
||||||
)
|
)
|
||||||
|
|
||||||
return ErrSecret.Wrap(err)
|
return ErrAPIKeysDB.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check checks if apikey exists in db by token.
|
// Check checks if api key exists in db by secret.
|
||||||
func (db *secretDB) Check(ctx context.Context, token apikeys.Secret) (err error) {
|
func (db *apiKeysDB) Check(ctx context.Context, secret multinodeauth.Secret) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
var bytes []uint8
|
var bytes []uint8
|
||||||
@ -53,7 +54,7 @@ func (db *secretDB) Check(ctx context.Context, token apikeys.Secret) (err error)
|
|||||||
|
|
||||||
rowStub := db.QueryRowContext(ctx,
|
rowStub := db.QueryRowContext(ctx,
|
||||||
`SELECT token, created_at FROM secret WHERE token = ?`,
|
`SELECT token, created_at FROM secret WHERE token = ?`,
|
||||||
token[:],
|
secret[:],
|
||||||
)
|
)
|
||||||
|
|
||||||
err = rowStub.Scan(
|
err = rowStub.Scan(
|
||||||
@ -62,21 +63,21 @@ func (db *secretDB) Check(ctx context.Context, token apikeys.Secret) (err error)
|
|||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, sql.ErrNoRows) {
|
if errors.Is(err, sql.ErrNoRows) {
|
||||||
return apikeys.ErrNoSecret.Wrap(err)
|
return apikeys.ErrNoAPIKey.Wrap(err)
|
||||||
}
|
}
|
||||||
return ErrSecret.Wrap(err)
|
return ErrAPIKeysDB.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Revoke removes apikey from db.
|
// Revoke removes api key from db.
|
||||||
func (db *secretDB) Revoke(ctx context.Context, secret apikeys.Secret) (err error) {
|
func (db *apiKeysDB) Revoke(ctx context.Context, secret multinodeauth.Secret) (err error) {
|
||||||
defer mon.Task()(&ctx)(&err)
|
defer mon.Task()(&ctx)(&err)
|
||||||
|
|
||||||
query := `DELETE FROM secret WHERE token = ?`
|
query := `DELETE FROM secret WHERE token = ?`
|
||||||
|
|
||||||
_, err = db.ExecContext(ctx, query, secret[:])
|
_, err = db.ExecContext(ctx, query, secret[:])
|
||||||
|
|
||||||
return ErrSecret.Wrap(err)
|
return ErrAPIKeysDB.Wrap(err)
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ type DB struct {
|
|||||||
notificationsDB *notificationDB
|
notificationsDB *notificationDB
|
||||||
payoutDB *payoutDB
|
payoutDB *payoutDB
|
||||||
pricingDB *pricingDB
|
pricingDB *pricingDB
|
||||||
secretDB *secretDB
|
apiKeysDB *apiKeysDB
|
||||||
|
|
||||||
SQLDBs map[string]DBContainer
|
SQLDBs map[string]DBContainer
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ func OpenNew(ctx context.Context, log *zap.Logger, config Config) (*DB, error) {
|
|||||||
notificationsDB := ¬ificationDB{}
|
notificationsDB := ¬ificationDB{}
|
||||||
payoutDB := &payoutDB{}
|
payoutDB := &payoutDB{}
|
||||||
pricingDB := &pricingDB{}
|
pricingDB := &pricingDB{}
|
||||||
secretDB := &secretDB{}
|
apiKeysDB := &apiKeysDB{}
|
||||||
|
|
||||||
db := &DB{
|
db := &DB{
|
||||||
log: log,
|
log: log,
|
||||||
@ -157,7 +157,7 @@ func OpenNew(ctx context.Context, log *zap.Logger, config Config) (*DB, error) {
|
|||||||
notificationsDB: notificationsDB,
|
notificationsDB: notificationsDB,
|
||||||
payoutDB: payoutDB,
|
payoutDB: payoutDB,
|
||||||
pricingDB: pricingDB,
|
pricingDB: pricingDB,
|
||||||
secretDB: secretDB,
|
apiKeysDB: apiKeysDB,
|
||||||
|
|
||||||
SQLDBs: map[string]DBContainer{
|
SQLDBs: map[string]DBContainer{
|
||||||
DeprecatedInfoDBName: deprecatedInfoDB,
|
DeprecatedInfoDBName: deprecatedInfoDB,
|
||||||
@ -173,7 +173,7 @@ func OpenNew(ctx context.Context, log *zap.Logger, config Config) (*DB, error) {
|
|||||||
NotificationsDBName: notificationsDB,
|
NotificationsDBName: notificationsDB,
|
||||||
HeldAmountDBName: payoutDB,
|
HeldAmountDBName: payoutDB,
|
||||||
PricingDBName: pricingDB,
|
PricingDBName: pricingDB,
|
||||||
SecretDBName: secretDB,
|
APIKeysDBName: apiKeysDB,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ func OpenExisting(ctx context.Context, log *zap.Logger, config Config) (*DB, err
|
|||||||
notificationsDB := ¬ificationDB{}
|
notificationsDB := ¬ificationDB{}
|
||||||
payoutDB := &payoutDB{}
|
payoutDB := &payoutDB{}
|
||||||
pricingDB := &pricingDB{}
|
pricingDB := &pricingDB{}
|
||||||
secretDB := &secretDB{}
|
apiKeysDB := &apiKeysDB{}
|
||||||
|
|
||||||
db := &DB{
|
db := &DB{
|
||||||
log: log,
|
log: log,
|
||||||
@ -225,7 +225,7 @@ func OpenExisting(ctx context.Context, log *zap.Logger, config Config) (*DB, err
|
|||||||
notificationsDB: notificationsDB,
|
notificationsDB: notificationsDB,
|
||||||
payoutDB: payoutDB,
|
payoutDB: payoutDB,
|
||||||
pricingDB: pricingDB,
|
pricingDB: pricingDB,
|
||||||
secretDB: secretDB,
|
apiKeysDB: apiKeysDB,
|
||||||
|
|
||||||
SQLDBs: map[string]DBContainer{
|
SQLDBs: map[string]DBContainer{
|
||||||
DeprecatedInfoDBName: deprecatedInfoDB,
|
DeprecatedInfoDBName: deprecatedInfoDB,
|
||||||
@ -241,7 +241,7 @@ func OpenExisting(ctx context.Context, log *zap.Logger, config Config) (*DB, err
|
|||||||
NotificationsDBName: notificationsDB,
|
NotificationsDBName: notificationsDB,
|
||||||
HeldAmountDBName: payoutDB,
|
HeldAmountDBName: payoutDB,
|
||||||
PricingDBName: pricingDB,
|
PricingDBName: pricingDB,
|
||||||
SecretDBName: secretDB,
|
APIKeysDBName: apiKeysDB,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ func (db *DB) openDatabases(ctx context.Context) error {
|
|||||||
NotificationsDBName,
|
NotificationsDBName,
|
||||||
HeldAmountDBName,
|
HeldAmountDBName,
|
||||||
PricingDBName,
|
PricingDBName,
|
||||||
SecretDBName,
|
APIKeysDBName,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, dbName := range dbs {
|
for _, dbName := range dbs {
|
||||||
@ -543,9 +543,9 @@ func (db *DB) Pricing() pricing.DB {
|
|||||||
return db.pricingDB
|
return db.pricingDB
|
||||||
}
|
}
|
||||||
|
|
||||||
// Secret returns instance of the Secret database.
|
// APIKeys returns instance of the APIKeys database.
|
||||||
func (db *DB) Secret() apikeys.DB {
|
func (db *DB) APIKeys() apikeys.DB {
|
||||||
return db.secretDB
|
return db.apiKeysDB
|
||||||
}
|
}
|
||||||
|
|
||||||
// RawDatabases are required for testing purposes.
|
// RawDatabases are required for testing purposes.
|
||||||
@ -1812,11 +1812,11 @@ func (db *DB) Migration(ctx context.Context) *migrate.Migration {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
DB: &db.secretDB.DB,
|
DB: &db.apiKeysDB.DB,
|
||||||
Description: "Create secret table",
|
Description: "Create secret table",
|
||||||
Version: 46,
|
Version: 46,
|
||||||
CreateDB: func(ctx context.Context, log *zap.Logger) error {
|
CreateDB: func(ctx context.Context, log *zap.Logger) error {
|
||||||
if err := db.openDatabase(ctx, SecretDBName); err != nil {
|
if err := db.openDatabase(ctx, APIKeysDBName); err != nil {
|
||||||
return ErrDatabase.Wrap(err)
|
return ErrDatabase.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
storagenode/storagenodedb/testdata/v46.go
vendored
2
storagenode/storagenodedb/testdata/v46.go
vendored
@ -21,7 +21,7 @@ var v46 = MultiDBState{
|
|||||||
storagenodedb.NotificationsDBName: v43.DBStates[storagenodedb.NotificationsDBName],
|
storagenodedb.NotificationsDBName: v43.DBStates[storagenodedb.NotificationsDBName],
|
||||||
storagenodedb.HeldAmountDBName: v43.DBStates[storagenodedb.HeldAmountDBName],
|
storagenodedb.HeldAmountDBName: v43.DBStates[storagenodedb.HeldAmountDBName],
|
||||||
storagenodedb.PricingDBName: v43.DBStates[storagenodedb.PricingDBName],
|
storagenodedb.PricingDBName: v43.DBStates[storagenodedb.PricingDBName],
|
||||||
storagenodedb.SecretDBName: &DBState{
|
storagenodedb.APIKeysDBName: &DBState{
|
||||||
SQL: `
|
SQL: `
|
||||||
-- table to hold storagenode secret token
|
-- table to hold storagenode secret token
|
||||||
CREATE TABLE secret (
|
CREATE TABLE secret (
|
||||||
|
2
storagenode/storagenodedb/testdata/v47.go
vendored
2
storagenode/storagenodedb/testdata/v47.go
vendored
@ -51,6 +51,6 @@ var v47 = MultiDBState{
|
|||||||
storagenodedb.NotificationsDBName: v46.DBStates[storagenodedb.NotificationsDBName],
|
storagenodedb.NotificationsDBName: v46.DBStates[storagenodedb.NotificationsDBName],
|
||||||
storagenodedb.HeldAmountDBName: v46.DBStates[storagenodedb.HeldAmountDBName],
|
storagenodedb.HeldAmountDBName: v46.DBStates[storagenodedb.HeldAmountDBName],
|
||||||
storagenodedb.PricingDBName: v46.DBStates[storagenodedb.PricingDBName],
|
storagenodedb.PricingDBName: v46.DBStates[storagenodedb.PricingDBName],
|
||||||
storagenodedb.SecretDBName: v46.DBStates[storagenodedb.SecretDBName],
|
storagenodedb.APIKeysDBName: v46.DBStates[storagenodedb.APIKeysDBName],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user