storagenode/internalpb: move inspector.proto
Change-Id: I951379c3b2ff00d1bc09d6a49c026a7e723432d6
This commit is contained in:
parent
7ce372c686
commit
cda67a659a
@ -18,10 +18,10 @@ import (
|
||||
"go.uber.org/zap"
|
||||
|
||||
"storj.io/common/memory"
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/rpc"
|
||||
"storj.io/private/process"
|
||||
"storj.io/private/version"
|
||||
"storj.io/storj/storagenode/internalpb"
|
||||
)
|
||||
|
||||
const contactWindow = time.Hour * 2
|
||||
@ -38,8 +38,8 @@ func dialDashboardClient(ctx context.Context, address string) (*dashboardClient,
|
||||
return &dashboardClient{conn: conn}, nil
|
||||
}
|
||||
|
||||
func (dash *dashboardClient) dashboard(ctx context.Context) (*pb.DashboardResponse, error) {
|
||||
return pb.NewDRPCPieceStoreInspectorClient(dash.conn).Dashboard(ctx, &pb.DashboardRequest{})
|
||||
func (dash *dashboardClient) dashboard(ctx context.Context) (*internalpb.DashboardResponse, error) {
|
||||
return internalpb.NewDRPCPieceStoreInspectorClient(dash.conn).Dashboard(ctx, &internalpb.DashboardRequest{})
|
||||
}
|
||||
|
||||
func (dash *dashboardClient) close() error {
|
||||
@ -81,7 +81,7 @@ func cmdDashboard(cmd *cobra.Command, args []string) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
func printDashboard(data *pb.DashboardResponse) error {
|
||||
func printDashboard(data *internalpb.DashboardResponse) error {
|
||||
clearScreen()
|
||||
var warnFlag bool
|
||||
color.NoColor = !useColor
|
||||
|
@ -12,10 +12,10 @@ import (
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/rpc/rpcstatus"
|
||||
"storj.io/storj/storagenode/bandwidth"
|
||||
"storj.io/storj/storagenode/contact"
|
||||
"storj.io/storj/storagenode/internalpb"
|
||||
"storj.io/storj/storagenode/pieces"
|
||||
"storj.io/storj/storagenode/piecestore"
|
||||
)
|
||||
@ -68,12 +68,12 @@ func NewEndpoint(
|
||||
}
|
||||
|
||||
// Stats returns current statistics about the storage node.
|
||||
func (inspector *Endpoint) Stats(ctx context.Context, in *pb.StatsRequest) (out *pb.StatSummaryResponse, err error) {
|
||||
func (inspector *Endpoint) Stats(ctx context.Context, in *internalpb.StatsRequest) (out *internalpb.StatSummaryResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
return inspector.retrieveStats(ctx)
|
||||
}
|
||||
|
||||
func (inspector *Endpoint) retrieveStats(ctx context.Context) (_ *pb.StatSummaryResponse, err error) {
|
||||
func (inspector *Endpoint) retrieveStats(ctx context.Context) (_ *internalpb.StatSummaryResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
// Space Usage
|
||||
@ -91,7 +91,7 @@ func (inspector *Endpoint) retrieveStats(ctx context.Context) (_ *pb.StatSummary
|
||||
totalUsedBandwidth := usage.Total()
|
||||
availableSpace := inspector.pieceStoreConfig.AllocatedDiskSpace.Int64() - piecesContentSize
|
||||
|
||||
return &pb.StatSummaryResponse{
|
||||
return &internalpb.StatSummaryResponse{
|
||||
UsedSpace: piecesContentSize,
|
||||
AvailableSpace: availableSpace,
|
||||
UsedIngress: ingress,
|
||||
@ -101,12 +101,12 @@ func (inspector *Endpoint) retrieveStats(ctx context.Context) (_ *pb.StatSummary
|
||||
}
|
||||
|
||||
// Dashboard returns dashboard information.
|
||||
func (inspector *Endpoint) Dashboard(ctx context.Context, in *pb.DashboardRequest) (out *pb.DashboardResponse, err error) {
|
||||
func (inspector *Endpoint) Dashboard(ctx context.Context, in *internalpb.DashboardRequest) (out *internalpb.DashboardResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
return inspector.getDashboardData(ctx)
|
||||
}
|
||||
|
||||
func (inspector *Endpoint) getDashboardData(ctx context.Context) (_ *pb.DashboardResponse, err error) {
|
||||
func (inspector *Endpoint) getDashboardData(ctx context.Context) (_ *internalpb.DashboardResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
statsSummary, err := inspector.retrieveStats(ctx)
|
||||
@ -116,7 +116,7 @@ func (inspector *Endpoint) getDashboardData(ctx context.Context) (_ *pb.Dashboar
|
||||
|
||||
lastPingedAt := inspector.pingStats.WhenLastPinged()
|
||||
self := inspector.contact.Local()
|
||||
return &pb.DashboardResponse{
|
||||
return &internalpb.DashboardResponse{
|
||||
NodeId: self.ID,
|
||||
InternalAddress: "",
|
||||
ExternalAddress: self.Address,
|
||||
|
@ -11,11 +11,11 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"storj.io/common/memory"
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/sync2"
|
||||
"storj.io/common/testcontext"
|
||||
"storj.io/common/testrand"
|
||||
"storj.io/storj/private/testplanet"
|
||||
"storj.io/storj/storagenode/internalpb"
|
||||
)
|
||||
|
||||
func TestInspectorStats(t *testing.T) {
|
||||
@ -29,7 +29,7 @@ func TestInspectorStats(t *testing.T) {
|
||||
var availableSpace int64
|
||||
|
||||
for _, storageNode := range planet.StorageNodes {
|
||||
response, err := storageNode.Storage2.Inspector.Stats(ctx, &pb.StatsRequest{})
|
||||
response, err := storageNode.Storage2.Inspector.Stats(ctx, &internalpb.StatsRequest{})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Zero(t, response.UsedBandwidth)
|
||||
@ -65,7 +65,7 @@ func TestInspectorStats(t *testing.T) {
|
||||
|
||||
var downloaded int
|
||||
for _, storageNode := range planet.StorageNodes {
|
||||
response, err := storageNode.Storage2.Inspector.Stats(ctx, &pb.StatsRequest{})
|
||||
response, err := storageNode.Storage2.Inspector.Stats(ctx, &internalpb.StatsRequest{})
|
||||
require.NoError(t, err)
|
||||
|
||||
// TODO set more accurate assertions
|
||||
@ -95,7 +95,7 @@ func TestInspectorDashboard(t *testing.T) {
|
||||
SatelliteCount: 1, StorageNodeCount: 1, UplinkCount: 1,
|
||||
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
||||
for _, storageNode := range planet.StorageNodes {
|
||||
response, err := storageNode.Storage2.Inspector.Dashboard(ctx, &pb.DashboardRequest{})
|
||||
response, err := storageNode.Storage2.Inspector.Dashboard(ctx, &internalpb.DashboardRequest{})
|
||||
require.NoError(t, err)
|
||||
|
||||
uptime, err := time.ParseDuration(response.Uptime)
|
||||
@ -112,7 +112,7 @@ func TestInspectorDashboard(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
for _, storageNode := range planet.StorageNodes {
|
||||
response, err := storageNode.Storage2.Inspector.Dashboard(ctx, &pb.DashboardRequest{})
|
||||
response, err := storageNode.Storage2.Inspector.Dashboard(ctx, &internalpb.DashboardRequest{})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.True(t, response.LastPinged.After(testStartedTime))
|
||||
|
7
storagenode/internalpb/doc.go
Normal file
7
storagenode/internalpb/doc.go
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright (C) 2020 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
//go:generate go run gen.go
|
||||
|
||||
// Package internalpb contains proto definitions for storagenode internal tools.
|
||||
package internalpb
|
122
storagenode/internalpb/gen.go
Normal file
122
storagenode/internalpb/gen.go
Normal file
@ -0,0 +1,122 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
mainpkg = flag.String("pkg", "storj.io/storj/storagenode/internalpb", "main package name")
|
||||
protoc = flag.String("protoc", "protoc", "protoc compiler")
|
||||
)
|
||||
|
||||
var ignoreProto = map[string]bool{
|
||||
"gogo.proto": true,
|
||||
}
|
||||
|
||||
func ignore(files []string) []string {
|
||||
xs := []string{}
|
||||
for _, file := range files {
|
||||
if !ignoreProto[file] {
|
||||
xs = append(xs, file)
|
||||
}
|
||||
}
|
||||
return xs
|
||||
}
|
||||
|
||||
// Programs needed for code generation:
|
||||
//
|
||||
// github.com/ckaznocha/protoc-gen-lint
|
||||
// storj.io/drpc/cmd/protoc-gen-drpc
|
||||
// github.com/nilslice/protolock/cmd/protolock
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
// TODO: protolock
|
||||
|
||||
{
|
||||
// cleanup previous files
|
||||
localfiles, err := filepath.Glob("*.pb.go")
|
||||
check(err)
|
||||
|
||||
all := []string{}
|
||||
all = append(all, localfiles...)
|
||||
for _, match := range all {
|
||||
_ = os.Remove(match)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
protofiles, err := filepath.Glob("*.proto")
|
||||
check(err)
|
||||
|
||||
protofiles = ignore(protofiles)
|
||||
|
||||
commonPb := os.Getenv("STORJ_COMMON_PB")
|
||||
if commonPb == "" {
|
||||
commonPb = "../../../common/pb"
|
||||
}
|
||||
|
||||
overrideImports := ",Mgoogle/protobuf/timestamp.proto=storj.io/storj/storagenode/internalpb"
|
||||
args := []string{
|
||||
"--lint_out=.",
|
||||
"--drpc_out=plugins=drpc,paths=source_relative" + overrideImports + ":.",
|
||||
"-I=.",
|
||||
"-I=" + commonPb,
|
||||
}
|
||||
args = append(args, protofiles...)
|
||||
|
||||
// generate new code
|
||||
cmd := exec.Command(*protoc, args...)
|
||||
fmt.Println(strings.Join(cmd.Args, " "))
|
||||
out, err := cmd.CombinedOutput()
|
||||
fmt.Println(string(out))
|
||||
check(err)
|
||||
}
|
||||
|
||||
{
|
||||
files, err := filepath.Glob("*.pb.go")
|
||||
check(err)
|
||||
for _, file := range files {
|
||||
process(file)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// format code to get rid of extra imports
|
||||
out, err := exec.Command("goimports", "-local", "storj.io", "-w", ".").CombinedOutput()
|
||||
fmt.Println(string(out))
|
||||
check(err)
|
||||
}
|
||||
}
|
||||
|
||||
func process(file string) {
|
||||
data, err := ioutil.ReadFile(file)
|
||||
check(err)
|
||||
|
||||
source := string(data)
|
||||
|
||||
// When generating code to the same path as proto, it will
|
||||
// end up generating an `import _ "."`, the following replace removes it.
|
||||
source = strings.Replace(source, `_ "."`, "", -1)
|
||||
|
||||
err = ioutil.WriteFile(file, []byte(source), 0644)
|
||||
check(err)
|
||||
}
|
||||
|
||||
func check(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
143
storagenode/internalpb/gogo.proto
Normal file
143
storagenode/internalpb/gogo.proto
Normal file
@ -0,0 +1,143 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package gogoproto;
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
option java_package = "com.google.protobuf";
|
||||
option java_outer_classname = "GoGoProtos";
|
||||
|
||||
extend google.protobuf.EnumOptions {
|
||||
optional bool goproto_enum_prefix = 62001;
|
||||
optional bool goproto_enum_stringer = 62021;
|
||||
optional bool enum_stringer = 62022;
|
||||
optional string enum_customname = 62023;
|
||||
optional bool enumdecl = 62024;
|
||||
}
|
||||
|
||||
extend google.protobuf.EnumValueOptions {
|
||||
optional string enumvalue_customname = 66001;
|
||||
}
|
||||
|
||||
extend google.protobuf.FileOptions {
|
||||
optional bool goproto_getters_all = 63001;
|
||||
optional bool goproto_enum_prefix_all = 63002;
|
||||
optional bool goproto_stringer_all = 63003;
|
||||
optional bool verbose_equal_all = 63004;
|
||||
optional bool face_all = 63005;
|
||||
optional bool gostring_all = 63006;
|
||||
optional bool populate_all = 63007;
|
||||
optional bool stringer_all = 63008;
|
||||
optional bool onlyone_all = 63009;
|
||||
|
||||
optional bool equal_all = 63013;
|
||||
optional bool description_all = 63014;
|
||||
optional bool testgen_all = 63015;
|
||||
optional bool benchgen_all = 63016;
|
||||
optional bool marshaler_all = 63017;
|
||||
optional bool unmarshaler_all = 63018;
|
||||
optional bool stable_marshaler_all = 63019;
|
||||
|
||||
optional bool sizer_all = 63020;
|
||||
|
||||
optional bool goproto_enum_stringer_all = 63021;
|
||||
optional bool enum_stringer_all = 63022;
|
||||
|
||||
optional bool unsafe_marshaler_all = 63023;
|
||||
optional bool unsafe_unmarshaler_all = 63024;
|
||||
|
||||
optional bool goproto_extensions_map_all = 63025;
|
||||
optional bool goproto_unrecognized_all = 63026;
|
||||
optional bool gogoproto_import = 63027;
|
||||
optional bool protosizer_all = 63028;
|
||||
optional bool compare_all = 63029;
|
||||
optional bool typedecl_all = 63030;
|
||||
optional bool enumdecl_all = 63031;
|
||||
|
||||
optional bool goproto_registration = 63032;
|
||||
optional bool messagename_all = 63033;
|
||||
|
||||
optional bool goproto_sizecache_all = 63034;
|
||||
optional bool goproto_unkeyed_all = 63035;
|
||||
}
|
||||
|
||||
extend google.protobuf.MessageOptions {
|
||||
optional bool goproto_getters = 64001;
|
||||
optional bool goproto_stringer = 64003;
|
||||
optional bool verbose_equal = 64004;
|
||||
optional bool face = 64005;
|
||||
optional bool gostring = 64006;
|
||||
optional bool populate = 64007;
|
||||
optional bool stringer = 67008;
|
||||
optional bool onlyone = 64009;
|
||||
|
||||
optional bool equal = 64013;
|
||||
optional bool description = 64014;
|
||||
optional bool testgen = 64015;
|
||||
optional bool benchgen = 64016;
|
||||
optional bool marshaler = 64017;
|
||||
optional bool unmarshaler = 64018;
|
||||
optional bool stable_marshaler = 64019;
|
||||
|
||||
optional bool sizer = 64020;
|
||||
|
||||
optional bool unsafe_marshaler = 64023;
|
||||
optional bool unsafe_unmarshaler = 64024;
|
||||
|
||||
optional bool goproto_extensions_map = 64025;
|
||||
optional bool goproto_unrecognized = 64026;
|
||||
|
||||
optional bool protosizer = 64028;
|
||||
|
||||
optional bool typedecl = 64030;
|
||||
|
||||
optional bool messagename = 64033;
|
||||
|
||||
optional bool goproto_sizecache = 64034;
|
||||
optional bool goproto_unkeyed = 64035;
|
||||
}
|
||||
|
||||
extend google.protobuf.FieldOptions {
|
||||
optional bool nullable = 65001;
|
||||
optional bool embed = 65002;
|
||||
optional string customtype = 65003;
|
||||
optional string customname = 65004;
|
||||
optional string jsontag = 65005;
|
||||
optional string moretags = 65006;
|
||||
optional string casttype = 65007;
|
||||
optional string castkey = 65008;
|
||||
optional string castvalue = 65009;
|
||||
|
||||
optional bool stdtime = 65010;
|
||||
optional bool stdduration = 65011;
|
||||
optional bool wktpointer = 65012;
|
||||
optional bool compare = 65013;
|
||||
|
||||
}
|
442
storagenode/internalpb/inspector.pb.go
Normal file
442
storagenode/internalpb/inspector.pb.go
Normal file
@ -0,0 +1,442 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: inspector.proto
|
||||
|
||||
package internalpb
|
||||
|
||||
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 StatsRequest struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StatsRequest) Reset() { *m = StatsRequest{} }
|
||||
func (m *StatsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StatsRequest) ProtoMessage() {}
|
||||
func (*StatsRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a07d9034b2dd9d26, []int{0}
|
||||
}
|
||||
func (m *StatsRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_StatsRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *StatsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_StatsRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *StatsRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_StatsRequest.Merge(m, src)
|
||||
}
|
||||
func (m *StatsRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_StatsRequest.Size(m)
|
||||
}
|
||||
func (m *StatsRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_StatsRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_StatsRequest proto.InternalMessageInfo
|
||||
|
||||
type StatSummaryResponse struct {
|
||||
UsedSpace int64 `protobuf:"varint,1,opt,name=used_space,json=usedSpace,proto3" json:"used_space,omitempty"`
|
||||
AvailableSpace int64 `protobuf:"varint,2,opt,name=available_space,json=availableSpace,proto3" json:"available_space,omitempty"`
|
||||
UsedIngress int64 `protobuf:"varint,3,opt,name=used_ingress,json=usedIngress,proto3" json:"used_ingress,omitempty"`
|
||||
UsedEgress int64 `protobuf:"varint,4,opt,name=used_egress,json=usedEgress,proto3" json:"used_egress,omitempty"`
|
||||
UsedBandwidth int64 `protobuf:"varint,5,opt,name=used_bandwidth,json=usedBandwidth,proto3" json:"used_bandwidth,omitempty"`
|
||||
AvailableBandwidth int64 `protobuf:"varint,6,opt,name=available_bandwidth,json=availableBandwidth,proto3" json:"available_bandwidth,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StatSummaryResponse) Reset() { *m = StatSummaryResponse{} }
|
||||
func (m *StatSummaryResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StatSummaryResponse) ProtoMessage() {}
|
||||
func (*StatSummaryResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a07d9034b2dd9d26, []int{1}
|
||||
}
|
||||
func (m *StatSummaryResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_StatSummaryResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *StatSummaryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_StatSummaryResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *StatSummaryResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_StatSummaryResponse.Merge(m, src)
|
||||
}
|
||||
func (m *StatSummaryResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_StatSummaryResponse.Size(m)
|
||||
}
|
||||
func (m *StatSummaryResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_StatSummaryResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_StatSummaryResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *StatSummaryResponse) GetUsedSpace() int64 {
|
||||
if m != nil {
|
||||
return m.UsedSpace
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StatSummaryResponse) GetAvailableSpace() int64 {
|
||||
if m != nil {
|
||||
return m.AvailableSpace
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StatSummaryResponse) GetUsedIngress() int64 {
|
||||
if m != nil {
|
||||
return m.UsedIngress
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StatSummaryResponse) GetUsedEgress() int64 {
|
||||
if m != nil {
|
||||
return m.UsedEgress
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StatSummaryResponse) GetUsedBandwidth() int64 {
|
||||
if m != nil {
|
||||
return m.UsedBandwidth
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *StatSummaryResponse) GetAvailableBandwidth() int64 {
|
||||
if m != nil {
|
||||
return m.AvailableBandwidth
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DashboardRequest struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *DashboardRequest) Reset() { *m = DashboardRequest{} }
|
||||
func (m *DashboardRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DashboardRequest) ProtoMessage() {}
|
||||
func (*DashboardRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a07d9034b2dd9d26, []int{2}
|
||||
}
|
||||
func (m *DashboardRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_DashboardRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *DashboardRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_DashboardRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *DashboardRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_DashboardRequest.Merge(m, src)
|
||||
}
|
||||
func (m *DashboardRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_DashboardRequest.Size(m)
|
||||
}
|
||||
func (m *DashboardRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_DashboardRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_DashboardRequest proto.InternalMessageInfo
|
||||
|
||||
type DashboardResponse struct {
|
||||
NodeId NodeID `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"`
|
||||
NodeConnections int64 `protobuf:"varint,2,opt,name=node_connections,json=nodeConnections,proto3" json:"node_connections,omitempty"`
|
||||
BootstrapAddress string `protobuf:"bytes,3,opt,name=bootstrap_address,json=bootstrapAddress,proto3" json:"bootstrap_address,omitempty"` // Deprecated: Do not use.
|
||||
InternalAddress string `protobuf:"bytes,4,opt,name=internal_address,json=internalAddress,proto3" json:"internal_address,omitempty"`
|
||||
ExternalAddress string `protobuf:"bytes,5,opt,name=external_address,json=externalAddress,proto3" json:"external_address,omitempty"`
|
||||
DashboardAddress string `protobuf:"bytes,6,opt,name=dashboard_address,json=dashboardAddress,proto3" json:"dashboard_address,omitempty"`
|
||||
Stats *StatSummaryResponse `protobuf:"bytes,7,opt,name=stats,proto3" json:"stats,omitempty"`
|
||||
Uptime string `protobuf:"bytes,8,opt,name=uptime,proto3" json:"uptime,omitempty"`
|
||||
LastPinged time.Time `protobuf:"bytes,9,opt,name=last_pinged,json=lastPinged,proto3,stdtime" json:"last_pinged"`
|
||||
LastQueried time.Time `protobuf:"bytes,10,opt,name=last_queried,json=lastQueried,proto3,stdtime" json:"last_queried"`
|
||||
LastPingFromId *NodeID `protobuf:"bytes,11,opt,name=last_ping_from_id,json=lastPingFromId,proto3,customtype=NodeID" json:"last_ping_from_id,omitempty"`
|
||||
LastPingFromAddress string `protobuf:"bytes,12,opt,name=last_ping_from_address,json=lastPingFromAddress,proto3" json:"last_ping_from_address,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *DashboardResponse) Reset() { *m = DashboardResponse{} }
|
||||
func (m *DashboardResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*DashboardResponse) ProtoMessage() {}
|
||||
func (*DashboardResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a07d9034b2dd9d26, []int{3}
|
||||
}
|
||||
func (m *DashboardResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_DashboardResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *DashboardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_DashboardResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *DashboardResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_DashboardResponse.Merge(m, src)
|
||||
}
|
||||
func (m *DashboardResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_DashboardResponse.Size(m)
|
||||
}
|
||||
func (m *DashboardResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_DashboardResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_DashboardResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *DashboardResponse) GetNodeConnections() int64 {
|
||||
if m != nil {
|
||||
return m.NodeConnections
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Deprecated: Do not use.
|
||||
func (m *DashboardResponse) GetBootstrapAddress() string {
|
||||
if m != nil {
|
||||
return m.BootstrapAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *DashboardResponse) GetInternalAddress() string {
|
||||
if m != nil {
|
||||
return m.InternalAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *DashboardResponse) GetExternalAddress() string {
|
||||
if m != nil {
|
||||
return m.ExternalAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *DashboardResponse) GetDashboardAddress() string {
|
||||
if m != nil {
|
||||
return m.DashboardAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *DashboardResponse) GetStats() *StatSummaryResponse {
|
||||
if m != nil {
|
||||
return m.Stats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *DashboardResponse) GetUptime() string {
|
||||
if m != nil {
|
||||
return m.Uptime
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *DashboardResponse) GetLastPinged() time.Time {
|
||||
if m != nil {
|
||||
return m.LastPinged
|
||||
}
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
func (m *DashboardResponse) GetLastQueried() time.Time {
|
||||
if m != nil {
|
||||
return m.LastQueried
|
||||
}
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
func (m *DashboardResponse) GetLastPingFromAddress() string {
|
||||
if m != nil {
|
||||
return m.LastPingFromAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StatsRequest)(nil), "inspector.StatsRequest")
|
||||
proto.RegisterType((*StatSummaryResponse)(nil), "inspector.StatSummaryResponse")
|
||||
proto.RegisterType((*DashboardRequest)(nil), "inspector.DashboardRequest")
|
||||
proto.RegisterType((*DashboardResponse)(nil), "inspector.DashboardResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("inspector.proto", fileDescriptor_a07d9034b2dd9d26) }
|
||||
|
||||
var fileDescriptor_a07d9034b2dd9d26 = []byte{
|
||||
// 595 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcb, 0x6e, 0x13, 0x3f,
|
||||
0x14, 0xc6, 0x3b, 0x6d, 0x93, 0x36, 0x27, 0xf9, 0xe7, 0xe2, 0x48, 0xfd, 0x8f, 0xc2, 0x25, 0x25,
|
||||
0x52, 0xd5, 0x22, 0xa4, 0x44, 0x6a, 0xe1, 0x01, 0x08, 0x2d, 0x90, 0x0d, 0x2a, 0x13, 0x56, 0x6c,
|
||||
0x22, 0x4f, 0x7c, 0x3a, 0x35, 0x4a, 0xc6, 0x53, 0xdb, 0xe1, 0xf2, 0x16, 0xbc, 0x03, 0x2f, 0xc3,
|
||||
0x33, 0xb0, 0x28, 0x2b, 0x1e, 0x82, 0x1d, 0xf2, 0x99, 0x78, 0x12, 0x45, 0x95, 0x10, 0x9b, 0x28,
|
||||
0xfe, 0xce, 0xef, 0x9c, 0xb1, 0x3f, 0x7f, 0x86, 0x86, 0x4c, 0x4d, 0x86, 0x53, 0xab, 0x74, 0x3f,
|
||||
0xd3, 0xca, 0x2a, 0x56, 0x29, 0x84, 0x0e, 0x24, 0x2a, 0x51, 0xb9, 0xdc, 0xe9, 0x26, 0x4a, 0x25,
|
||||
0x33, 0x1c, 0xd0, 0x2a, 0x5e, 0x5c, 0x0d, 0xac, 0x9c, 0xa3, 0xb1, 0x7c, 0x9e, 0xe5, 0x40, 0xaf,
|
||||
0x0e, 0xb5, 0xb1, 0xe5, 0xd6, 0x44, 0x78, 0xb3, 0x40, 0x63, 0x7b, 0xbf, 0x03, 0x68, 0x3b, 0x61,
|
||||
0xbc, 0x98, 0xcf, 0xb9, 0xfe, 0x12, 0xa1, 0xc9, 0x54, 0x6a, 0x90, 0x3d, 0x00, 0x58, 0x18, 0x14,
|
||||
0x13, 0x93, 0xf1, 0x29, 0x86, 0xc1, 0x61, 0x70, 0xb2, 0x13, 0x55, 0x9c, 0x32, 0x76, 0x02, 0x3b,
|
||||
0x86, 0x06, 0xff, 0xc8, 0xe5, 0x8c, 0xc7, 0x33, 0x5c, 0x32, 0xdb, 0xc4, 0xd4, 0x0b, 0x39, 0x07,
|
||||
0x1f, 0x41, 0x8d, 0xe6, 0xc8, 0x34, 0xd1, 0x68, 0x4c, 0xb8, 0x43, 0x54, 0xd5, 0x69, 0xa3, 0x5c,
|
||||
0x62, 0x5d, 0xa0, 0xe5, 0x04, 0x73, 0x62, 0x97, 0x08, 0xfa, 0xfa, 0x45, 0x0e, 0x1c, 0x41, 0x9d,
|
||||
0x80, 0x98, 0xa7, 0xe2, 0x93, 0x14, 0xf6, 0x3a, 0x2c, 0x11, 0xf3, 0x9f, 0x53, 0x87, 0x5e, 0x64,
|
||||
0x03, 0x68, 0xaf, 0xf6, 0xb4, 0x62, 0xcb, 0xc4, 0xb2, 0xa2, 0x54, 0x34, 0xf4, 0x18, 0x34, 0xcf,
|
||||
0xb9, 0xb9, 0x8e, 0x15, 0xd7, 0xc2, 0xfb, 0xf1, 0x6b, 0x17, 0x5a, 0x6b, 0xe2, 0xd2, 0x8d, 0x63,
|
||||
0xd8, 0x4b, 0x95, 0xc0, 0x89, 0x14, 0x64, 0x45, 0x6d, 0x58, 0xff, 0x7e, 0xdb, 0xdd, 0xfa, 0x71,
|
||||
0xdb, 0x2d, 0xbf, 0x51, 0x02, 0x47, 0xe7, 0x51, 0xd9, 0x95, 0x47, 0x82, 0x3d, 0x86, 0x26, 0x81,
|
||||
0x53, 0x95, 0xa6, 0x38, 0xb5, 0x52, 0xa5, 0x66, 0x69, 0x4c, 0xc3, 0xe9, 0x2f, 0x56, 0x32, 0x1b,
|
||||
0x40, 0x2b, 0x56, 0xca, 0x1a, 0xab, 0x79, 0x36, 0xe1, 0x42, 0x14, 0xf6, 0x54, 0x86, 0xdb, 0x61,
|
||||
0x10, 0x35, 0x8b, 0xe2, 0xf3, 0xbc, 0xe6, 0x66, 0xcb, 0xd4, 0xa2, 0x4e, 0xf9, 0xac, 0xe0, 0x9d,
|
||||
0x59, 0x95, 0xa8, 0xe1, 0xf5, 0x35, 0x14, 0x3f, 0x6f, 0xa0, 0xa5, 0x1c, 0xf5, 0xba, 0x47, 0x9f,
|
||||
0x40, 0x4b, 0xf8, 0xf3, 0x16, 0x6c, 0x99, 0xd8, 0x66, 0x51, 0xf0, 0xf0, 0x53, 0x28, 0x19, 0x97,
|
||||
0x9e, 0x70, 0xef, 0x30, 0x38, 0xa9, 0x9e, 0x3e, 0xec, 0xaf, 0x62, 0x79, 0x47, 0x88, 0xa2, 0x1c,
|
||||
0x66, 0x07, 0x50, 0x5e, 0x64, 0x2e, 0x88, 0xe1, 0x3e, 0xcd, 0x5d, 0xae, 0xd8, 0x05, 0x54, 0x67,
|
||||
0xdc, 0xd8, 0x49, 0x26, 0xd3, 0x04, 0x45, 0x58, 0xa1, 0x99, 0x9d, 0x7e, 0x1e, 0xe1, 0xbe, 0x8f,
|
||||
0x70, 0xff, 0x9d, 0x8f, 0xf0, 0x70, 0xdf, 0xb9, 0xfe, 0xf5, 0x67, 0x37, 0x88, 0xc0, 0x35, 0x5e,
|
||||
0x52, 0x1f, 0x7b, 0x05, 0x35, 0x1a, 0x73, 0xb3, 0x40, 0x2d, 0x51, 0x84, 0xf0, 0x0f, 0x73, 0x68,
|
||||
0x03, 0x6f, 0xf3, 0x46, 0xf6, 0x0c, 0x5a, 0xc5, 0x7e, 0x26, 0x57, 0x5a, 0xcd, 0xdd, 0x7d, 0x57,
|
||||
0xe9, 0xbe, 0x61, 0xed, 0xae, 0xeb, 0xfe, 0xdb, 0x2f, 0xb5, 0x9a, 0x8f, 0x04, 0x3b, 0x83, 0x83,
|
||||
0x8d, 0x36, 0x6f, 0x63, 0x8d, 0x8e, 0xdb, 0x5e, 0xe7, 0x97, 0x4e, 0x9e, 0x7e, 0x0b, 0xa0, 0x7d,
|
||||
0x29, 0x71, 0x8a, 0x63, 0xab, 0x34, 0x8e, 0xbc, 0x8d, 0x6c, 0x08, 0x25, 0x7a, 0x9f, 0xec, 0xff,
|
||||
0x0d, 0x6f, 0xfd, 0x8b, 0xed, 0xfc, 0xc5, 0xf4, 0xde, 0x16, 0x7b, 0x0d, 0x95, 0x22, 0xc2, 0xec,
|
||||
0xde, 0x1a, 0xbe, 0x99, 0xf6, 0xce, 0xfd, 0xbb, 0x8b, 0x7e, 0xd2, 0xf0, 0xf8, 0xfd, 0x91, 0xb1,
|
||||
0x4a, 0x7f, 0xe8, 0x4b, 0x35, 0xa0, 0x3f, 0xf4, 0xcb, 0x13, 0x74, 0x61, 0x1e, 0xf8, 0xd4, 0x65,
|
||||
0x71, 0x5c, 0x26, 0x97, 0xcf, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb6, 0xbd, 0x86, 0x44, 0xa8,
|
||||
0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// --- DRPC BEGIN ---
|
||||
|
||||
type DRPCPieceStoreInspectorClient interface {
|
||||
DRPCConn() drpc.Conn
|
||||
|
||||
// Stats return space and bandwidth stats for a storagenode
|
||||
Stats(ctx context.Context, in *StatsRequest) (*StatSummaryResponse, error)
|
||||
// Dashboard returns stats for a specific storagenode
|
||||
Dashboard(ctx context.Context, in *DashboardRequest) (*DashboardResponse, error)
|
||||
}
|
||||
|
||||
type drpcPieceStoreInspectorClient struct {
|
||||
cc drpc.Conn
|
||||
}
|
||||
|
||||
func NewDRPCPieceStoreInspectorClient(cc drpc.Conn) DRPCPieceStoreInspectorClient {
|
||||
return &drpcPieceStoreInspectorClient{cc}
|
||||
}
|
||||
|
||||
func (c *drpcPieceStoreInspectorClient) DRPCConn() drpc.Conn { return c.cc }
|
||||
|
||||
func (c *drpcPieceStoreInspectorClient) Stats(ctx context.Context, in *StatsRequest) (*StatSummaryResponse, error) {
|
||||
out := new(StatSummaryResponse)
|
||||
err := c.cc.Invoke(ctx, "/inspector.PieceStoreInspector/Stats", in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcPieceStoreInspectorClient) Dashboard(ctx context.Context, in *DashboardRequest) (*DashboardResponse, error) {
|
||||
out := new(DashboardResponse)
|
||||
err := c.cc.Invoke(ctx, "/inspector.PieceStoreInspector/Dashboard", in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type DRPCPieceStoreInspectorServer interface {
|
||||
// Stats return space and bandwidth stats for a storagenode
|
||||
Stats(context.Context, *StatsRequest) (*StatSummaryResponse, error)
|
||||
// Dashboard returns stats for a specific storagenode
|
||||
Dashboard(context.Context, *DashboardRequest) (*DashboardResponse, error)
|
||||
}
|
||||
|
||||
type DRPCPieceStoreInspectorDescription struct{}
|
||||
|
||||
func (DRPCPieceStoreInspectorDescription) NumMethods() int { return 2 }
|
||||
|
||||
func (DRPCPieceStoreInspectorDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) {
|
||||
switch n {
|
||||
case 0:
|
||||
return "/inspector.PieceStoreInspector/Stats",
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCPieceStoreInspectorServer).
|
||||
Stats(
|
||||
ctx,
|
||||
in1.(*StatsRequest),
|
||||
)
|
||||
}, DRPCPieceStoreInspectorServer.Stats, true
|
||||
case 1:
|
||||
return "/inspector.PieceStoreInspector/Dashboard",
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCPieceStoreInspectorServer).
|
||||
Dashboard(
|
||||
ctx,
|
||||
in1.(*DashboardRequest),
|
||||
)
|
||||
}, DRPCPieceStoreInspectorServer.Dashboard, true
|
||||
default:
|
||||
return "", nil, nil, false
|
||||
}
|
||||
}
|
||||
|
||||
func DRPCRegisterPieceStoreInspector(mux drpc.Mux, impl DRPCPieceStoreInspectorServer) error {
|
||||
return mux.Register(impl, DRPCPieceStoreInspectorDescription{})
|
||||
}
|
||||
|
||||
type DRPCPieceStoreInspector_StatsStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*StatSummaryResponse) error
|
||||
}
|
||||
|
||||
type drpcPieceStoreInspectorStatsStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcPieceStoreInspectorStatsStream) SendAndClose(m *StatSummaryResponse) error {
|
||||
if err := x.MsgSend(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCPieceStoreInspector_DashboardStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*DashboardResponse) error
|
||||
}
|
||||
|
||||
type drpcPieceStoreInspectorDashboardStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcPieceStoreInspectorDashboardStream) SendAndClose(m *DashboardResponse) error {
|
||||
if err := x.MsgSend(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
// --- DRPC END ---
|
48
storagenode/internalpb/inspector.proto
Normal file
48
storagenode/internalpb/inspector.proto
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
syntax = "proto3";
|
||||
option go_package = "storj.io/storj/storagenode/internalpb";
|
||||
|
||||
import "gogo.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
package inspector;
|
||||
|
||||
service PieceStoreInspector {
|
||||
// Stats return space and bandwidth stats for a storagenode
|
||||
rpc Stats(StatsRequest) returns (StatSummaryResponse) {}
|
||||
// Dashboard returns stats for a specific storagenode
|
||||
rpc Dashboard(DashboardRequest) returns (DashboardResponse) {}
|
||||
}
|
||||
|
||||
|
||||
message StatsRequest {
|
||||
}
|
||||
|
||||
message StatSummaryResponse {
|
||||
int64 used_space = 1;
|
||||
int64 available_space = 2;
|
||||
int64 used_ingress = 3;
|
||||
int64 used_egress = 4;
|
||||
int64 used_bandwidth = 5;
|
||||
int64 available_bandwidth = 6;
|
||||
}
|
||||
|
||||
message DashboardRequest {
|
||||
}
|
||||
|
||||
message DashboardResponse {
|
||||
bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
||||
int64 node_connections = 2;
|
||||
string bootstrap_address = 3 [deprecated=true];
|
||||
string internal_address = 4;
|
||||
string external_address = 5;
|
||||
string dashboard_address = 6;
|
||||
StatSummaryResponse stats = 7;
|
||||
string uptime = 8;
|
||||
google.protobuf.Timestamp last_pinged = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
||||
google.protobuf.Timestamp last_queried = 10 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
||||
bytes last_ping_from_id = 11 [(gogoproto.customtype) = "NodeID"];
|
||||
string last_ping_from_address = 12;
|
||||
}
|
12
storagenode/internalpb/types.go
Normal file
12
storagenode/internalpb/types.go
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2020 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
package internalpb
|
||||
|
||||
import "storj.io/common/storj"
|
||||
|
||||
// PieceID is an alias to storj.PieceID for use in generated protobuf code.
|
||||
type PieceID = storj.PieceID
|
||||
|
||||
// NodeID is an alias to storj.NodeID for use in generated protobuf code.
|
||||
type NodeID = storj.NodeID
|
@ -10,10 +10,10 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"storj.io/common/memory"
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/testcontext"
|
||||
"storj.io/common/testrand"
|
||||
"storj.io/storj/private/testplanet"
|
||||
"storj.io/storj/storagenode/internalpb"
|
||||
)
|
||||
|
||||
func TestMonitor(t *testing.T) {
|
||||
@ -34,7 +34,7 @@ func TestMonitor(t *testing.T) {
|
||||
storageNode.Storage2.Monitor.Loop.TriggerWait()
|
||||
storageNode.Storage2.Monitor.VerifyDirReadableLoop.TriggerWait()
|
||||
storageNode.Storage2.Monitor.VerifyDirWritableLoop.TriggerWait()
|
||||
stats, err := storageNode.Storage2.Inspector.Stats(ctx, &pb.StatsRequest{})
|
||||
stats, err := storageNode.Storage2.Inspector.Stats(ctx, &internalpb.StatsRequest{})
|
||||
require.NoError(t, err)
|
||||
if stats.UsedSpace > 0 {
|
||||
nodeAssertions++
|
||||
|
@ -40,6 +40,7 @@ import (
|
||||
"storj.io/storj/storagenode/contact"
|
||||
"storj.io/storj/storagenode/gracefulexit"
|
||||
"storj.io/storj/storagenode/inspector"
|
||||
"storj.io/storj/storagenode/internalpb"
|
||||
"storj.io/storj/storagenode/monitor"
|
||||
"storj.io/storj/storagenode/nodestats"
|
||||
"storj.io/storj/storagenode/notifications"
|
||||
@ -681,7 +682,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten
|
||||
peer.Console.Listener.Addr(),
|
||||
config.Contact.ExternalAddress,
|
||||
)
|
||||
if err := pb.DRPCRegisterPieceStoreInspector(peer.Server.PrivateDRPC(), peer.Storage2.Inspector); err != nil {
|
||||
if err := internalpb.DRPCRegisterPieceStoreInspector(peer.Server.PrivateDRPC(), peer.Storage2.Inspector); err != nil {
|
||||
return nil, errs.Combine(err, peer.Close())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user