storagenode dashboard is working and passing tests locally (#1072)

* storagenode dashboard is working and passing tests locally

* linter fixes

* linter fixes

* moar linter fixes god

* review fixes and updates

* linter fixes
This commit is contained in:
Dylan Lott 2019-01-16 16:09:13 -05:00 committed by GitHub
parent 681d77c41a
commit 82b9b54695
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 553 additions and 121 deletions

View File

@ -6,13 +6,18 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"io"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime"
"sort" "sort"
"text/tabwriter" "text/tabwriter"
"github.com/fatih/color"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"go.uber.org/zap" "go.uber.org/zap"
@ -22,6 +27,7 @@ import (
"storj.io/storj/pkg/identity" "storj.io/storj/pkg/identity"
"storj.io/storj/pkg/kademlia" "storj.io/storj/pkg/kademlia"
"storj.io/storj/pkg/pb" "storj.io/storj/pkg/pb"
"storj.io/storj/pkg/piecestore/psclient"
"storj.io/storj/pkg/piecestore/psserver" "storj.io/storj/pkg/piecestore/psserver"
"storj.io/storj/pkg/piecestore/psserver/psdb" "storj.io/storj/pkg/piecestore/psserver/psdb"
"storj.io/storj/pkg/process" "storj.io/storj/pkg/process"
@ -69,7 +75,11 @@ var (
Short: "Diagnostic Tool support", Short: "Diagnostic Tool support",
RunE: cmdDiag, RunE: cmdDiag,
} }
dashboardCmd = &cobra.Command{
Use: "dashboard",
Short: "Display a dashbaord",
RunE: dashCmd,
}
runCfg StorageNode runCfg StorageNode
setupCfg StorageNode setupCfg StorageNode
@ -82,7 +92,6 @@ var (
) )
const ( const (
// default server address, only for storage node
defaultServerAddr = ":28967" defaultServerAddr = ":28967"
) )
@ -101,6 +110,7 @@ func init() {
rootCmd.AddCommand(setupCmd) rootCmd.AddCommand(setupCmd)
rootCmd.AddCommand(configCmd) rootCmd.AddCommand(configCmd)
rootCmd.AddCommand(diagCmd) rootCmd.AddCommand(diagCmd)
rootCmd.AddCommand(dashboardCmd)
cfgstruct.Bind(runCmd.Flags(), &runCfg, cfgstruct.ConfDir(defaultConfDir)) cfgstruct.Bind(runCmd.Flags(), &runCfg, cfgstruct.ConfDir(defaultConfDir))
cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir)) cfgstruct.BindSetup(setupCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir))
cfgstruct.BindSetup(configCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir)) cfgstruct.BindSetup(configCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir))
@ -124,7 +134,7 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
zap.S().Error("Failed to initialize telemetry batcher:", err) zap.S().Error("Failed to initialize telemetry batcher:", err)
} }
return runCfg.Server.Run(ctx, nil, runCfg.Kademlia, runCfg.Storage) return runCfg.Server.Run(process.Ctx(cmd), nil, runCfg.Kademlia, runCfg.Storage)
} }
func cmdSetup(cmd *cobra.Command, args []string) (err error) { func cmdSetup(cmd *cobra.Command, args []string) (err error) {
@ -301,6 +311,71 @@ func cmdDiag(cmd *cobra.Command, args []string) (err error) {
return err return err
} }
func dashCmd(cmd *cobra.Command, args []string) (err error) {
ctx := context.Background()
// create new client on localhost:7777
lc, err := psclient.NewLiteClient(ctx, ":7777")
if err != nil {
return err
}
stream, err := lc.Dashboard(ctx)
if err != nil {
return err
}
for {
data, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
return err
}
clr()
heading := color.New(color.FgGreen, color.Bold)
_, _ = heading.Printf("\nStorage Node Dashboard Stats\n")
_, _ = heading.Printf("\n===============================\n")
fmt.Fprintf(color.Output, "Node ID: %s\n", color.BlueString(data.GetNodeId()))
if data.GetConnection() {
fmt.Fprintf(color.Output, "%s ", color.GreenString("ONLINE"))
} else {
fmt.Fprintf(color.Output, "%s ", color.RedString("OFFLINE"))
}
uptime, err := ptypes.Duration(data.GetUptime())
if err != nil {
color.Red(" %+v \n", err)
} else {
color.Yellow(" %s \n", uptime)
}
fmt.Fprintf(color.Output, "Node Connections: %+v\n", whiteInt(data.GetNodeConnections()))
color.Green("\nIO\t\tAvailable\tUsed\n--\t\t---------\t----")
stats := data.GetStats()
if stats != nil {
fmt.Fprintf(color.Output, "Bandwidth\t%+v\t%+v\n", whiteInt(stats.GetAvailableBandwidth()), whiteInt(stats.GetUsedBandwidth()))
fmt.Fprintf(color.Output, "Disk\t\t%+v\t%+v\n", whiteInt(stats.GetAvailableSpace()), whiteInt(stats.GetUsedSpace()))
} else {
color.Yellow("Loading...")
}
}
return nil
}
func whiteInt(value int64) string {
return color.WhiteString(fmt.Sprintf("%+v", value))
}
func isOperatorEmailValid(email string) error { func isOperatorEmailValid(email string) error {
if email == "" { if email == "" {
return fmt.Errorf("Operator mail address isn't specified") return fmt.Errorf("Operator mail address isn't specified")
@ -319,6 +394,42 @@ func isOperatorWalletValid(wallet string) error {
return nil return nil
} }
// clr clears the screen so it can be redrawn
func clr() {
var clear = make(map[string]func())
clear["linux"] = func() {
cmd := exec.Command("clear")
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
_ = fmt.Errorf("Linux clear screen command returned an error %+v", err)
}
}
clear["darwin"] = func() {
cmd := exec.Command("clear")
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
_ = fmt.Errorf("MacOS clear screen command returned an error %+v", err)
}
}
clear["windows"] = func() {
cmd := exec.Command("cmd", "/c", "cls")
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
_ = fmt.Errorf("Windows clear screen command returned an error %+v", err)
}
}
value, ok := clear[runtime.GOOS]
if ok {
value()
} else {
panic("Your platform is unsupported! I can't clear terminal screen :(")
}
}
func main() { func main() {
process.Exec(rootCmd) process.Exec(rootCmd)
} }

View File

@ -48,6 +48,11 @@ func main() {
Type: pb.NodeType_STORAGE, Type: pb.NodeType_STORAGE,
} }
tc := transport.NewClient(clientIdent) tc := transport.NewClient(clientIdent)
// create a new liteclient for dashboard on localhost port 7777
liteClient, err := psclient.NewLiteClient(ctx, ":7777")
if err != nil {
log.Fatalf("could not initialize lite client: %s", err)
}
psClient, err := psclient.NewPSClient(ctx, tc, n, 0) psClient, err := psclient.NewPSClient(ctx, tc, n, 0)
if err != nil { if err != nil {
log.Fatalf("could not initialize Client: %s", err) log.Fatalf("could not initialize Client: %s", err)
@ -232,7 +237,7 @@ func main() {
Short: "Retrieve statistics", Short: "Retrieve statistics",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
var summary *pb.StatSummary var summary *pb.StatSummary
summary, err := psClient.Stats(context.Background()) summary, err := liteClient.Stats(context.Background())
if err != nil { if err != nil {
return err return err
} }

2
go.mod
View File

@ -37,7 +37,7 @@ require (
github.com/eapache/queue v1.1.0 // indirect github.com/eapache/queue v1.1.0 // indirect
github.com/eclipse/paho.mqtt.golang v1.1.1 // indirect github.com/eclipse/paho.mqtt.golang v1.1.1 // indirect
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
github.com/fatih/color v1.7.0 // indirect github.com/fatih/color v1.7.0
github.com/fatih/structs v1.0.0 // indirect github.com/fatih/structs v1.0.0 // indirect
github.com/go-redis/redis v6.14.1+incompatible github.com/go-redis/redis v6.14.1+incompatible
github.com/gogo/protobuf v1.1.2-0.20181116123445-07eab6a8298c github.com/gogo/protobuf v1.1.2-0.20181116123445-07eab6a8298c

View File

@ -36,7 +36,7 @@ func (m *GetStatsRequest) Reset() { *m = GetStatsRequest{} }
func (m *GetStatsRequest) String() string { return proto.CompactTextString(m) } func (m *GetStatsRequest) String() string { return proto.CompactTextString(m) }
func (*GetStatsRequest) ProtoMessage() {} func (*GetStatsRequest) ProtoMessage() {}
func (*GetStatsRequest) Descriptor() ([]byte, []int) { func (*GetStatsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{0} return fileDescriptor_inspector_27853f276f81267a, []int{0}
} }
func (m *GetStatsRequest) XXX_Unmarshal(b []byte) error { func (m *GetStatsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetStatsRequest.Unmarshal(m, b) return xxx_messageInfo_GetStatsRequest.Unmarshal(m, b)
@ -70,7 +70,7 @@ func (m *GetStatsResponse) Reset() { *m = GetStatsResponse{} }
func (m *GetStatsResponse) String() string { return proto.CompactTextString(m) } func (m *GetStatsResponse) String() string { return proto.CompactTextString(m) }
func (*GetStatsResponse) ProtoMessage() {} func (*GetStatsResponse) ProtoMessage() {}
func (*GetStatsResponse) Descriptor() ([]byte, []int) { func (*GetStatsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{1} return fileDescriptor_inspector_27853f276f81267a, []int{1}
} }
func (m *GetStatsResponse) XXX_Unmarshal(b []byte) error { func (m *GetStatsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetStatsResponse.Unmarshal(m, b) return xxx_messageInfo_GetStatsResponse.Unmarshal(m, b)
@ -134,7 +134,7 @@ func (m *CreateStatsRequest) Reset() { *m = CreateStatsRequest{} }
func (m *CreateStatsRequest) String() string { return proto.CompactTextString(m) } func (m *CreateStatsRequest) String() string { return proto.CompactTextString(m) }
func (*CreateStatsRequest) ProtoMessage() {} func (*CreateStatsRequest) ProtoMessage() {}
func (*CreateStatsRequest) Descriptor() ([]byte, []int) { func (*CreateStatsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{2} return fileDescriptor_inspector_27853f276f81267a, []int{2}
} }
func (m *CreateStatsRequest) XXX_Unmarshal(b []byte) error { func (m *CreateStatsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateStatsRequest.Unmarshal(m, b) return xxx_messageInfo_CreateStatsRequest.Unmarshal(m, b)
@ -192,7 +192,7 @@ func (m *CreateStatsResponse) Reset() { *m = CreateStatsResponse{} }
func (m *CreateStatsResponse) String() string { return proto.CompactTextString(m) } func (m *CreateStatsResponse) String() string { return proto.CompactTextString(m) }
func (*CreateStatsResponse) ProtoMessage() {} func (*CreateStatsResponse) ProtoMessage() {}
func (*CreateStatsResponse) Descriptor() ([]byte, []int) { func (*CreateStatsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{3} return fileDescriptor_inspector_27853f276f81267a, []int{3}
} }
func (m *CreateStatsResponse) XXX_Unmarshal(b []byte) error { func (m *CreateStatsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateStatsResponse.Unmarshal(m, b) return xxx_messageInfo_CreateStatsResponse.Unmarshal(m, b)
@ -224,7 +224,7 @@ func (m *CountNodesResponse) Reset() { *m = CountNodesResponse{} }
func (m *CountNodesResponse) String() string { return proto.CompactTextString(m) } func (m *CountNodesResponse) String() string { return proto.CompactTextString(m) }
func (*CountNodesResponse) ProtoMessage() {} func (*CountNodesResponse) ProtoMessage() {}
func (*CountNodesResponse) Descriptor() ([]byte, []int) { func (*CountNodesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{4} return fileDescriptor_inspector_27853f276f81267a, []int{4}
} }
func (m *CountNodesResponse) XXX_Unmarshal(b []byte) error { func (m *CountNodesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CountNodesResponse.Unmarshal(m, b) return xxx_messageInfo_CountNodesResponse.Unmarshal(m, b)
@ -261,7 +261,7 @@ func (m *CountNodesRequest) Reset() { *m = CountNodesRequest{} }
func (m *CountNodesRequest) String() string { return proto.CompactTextString(m) } func (m *CountNodesRequest) String() string { return proto.CompactTextString(m) }
func (*CountNodesRequest) ProtoMessage() {} func (*CountNodesRequest) ProtoMessage() {}
func (*CountNodesRequest) Descriptor() ([]byte, []int) { func (*CountNodesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{5} return fileDescriptor_inspector_27853f276f81267a, []int{5}
} }
func (m *CountNodesRequest) XXX_Unmarshal(b []byte) error { func (m *CountNodesRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CountNodesRequest.Unmarshal(m, b) return xxx_messageInfo_CountNodesRequest.Unmarshal(m, b)
@ -292,7 +292,7 @@ func (m *GetBucketsRequest) Reset() { *m = GetBucketsRequest{} }
func (m *GetBucketsRequest) String() string { return proto.CompactTextString(m) } func (m *GetBucketsRequest) String() string { return proto.CompactTextString(m) }
func (*GetBucketsRequest) ProtoMessage() {} func (*GetBucketsRequest) ProtoMessage() {}
func (*GetBucketsRequest) Descriptor() ([]byte, []int) { func (*GetBucketsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{6} return fileDescriptor_inspector_27853f276f81267a, []int{6}
} }
func (m *GetBucketsRequest) XXX_Unmarshal(b []byte) error { func (m *GetBucketsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBucketsRequest.Unmarshal(m, b) return xxx_messageInfo_GetBucketsRequest.Unmarshal(m, b)
@ -324,7 +324,7 @@ func (m *GetBucketsResponse) Reset() { *m = GetBucketsResponse{} }
func (m *GetBucketsResponse) String() string { return proto.CompactTextString(m) } func (m *GetBucketsResponse) String() string { return proto.CompactTextString(m) }
func (*GetBucketsResponse) ProtoMessage() {} func (*GetBucketsResponse) ProtoMessage() {}
func (*GetBucketsResponse) Descriptor() ([]byte, []int) { func (*GetBucketsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{7} return fileDescriptor_inspector_27853f276f81267a, []int{7}
} }
func (m *GetBucketsResponse) XXX_Unmarshal(b []byte) error { func (m *GetBucketsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBucketsResponse.Unmarshal(m, b) return xxx_messageInfo_GetBucketsResponse.Unmarshal(m, b)
@ -363,7 +363,7 @@ func (m *GetBucketRequest) Reset() { *m = GetBucketRequest{} }
func (m *GetBucketRequest) String() string { return proto.CompactTextString(m) } func (m *GetBucketRequest) String() string { return proto.CompactTextString(m) }
func (*GetBucketRequest) ProtoMessage() {} func (*GetBucketRequest) ProtoMessage() {}
func (*GetBucketRequest) Descriptor() ([]byte, []int) { func (*GetBucketRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{8} return fileDescriptor_inspector_27853f276f81267a, []int{8}
} }
func (m *GetBucketRequest) XXX_Unmarshal(b []byte) error { func (m *GetBucketRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBucketRequest.Unmarshal(m, b) return xxx_messageInfo_GetBucketRequest.Unmarshal(m, b)
@ -395,7 +395,7 @@ func (m *GetBucketResponse) Reset() { *m = GetBucketResponse{} }
func (m *GetBucketResponse) String() string { return proto.CompactTextString(m) } func (m *GetBucketResponse) String() string { return proto.CompactTextString(m) }
func (*GetBucketResponse) ProtoMessage() {} func (*GetBucketResponse) ProtoMessage() {}
func (*GetBucketResponse) Descriptor() ([]byte, []int) { func (*GetBucketResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{9} return fileDescriptor_inspector_27853f276f81267a, []int{9}
} }
func (m *GetBucketResponse) XXX_Unmarshal(b []byte) error { func (m *GetBucketResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBucketResponse.Unmarshal(m, b) return xxx_messageInfo_GetBucketResponse.Unmarshal(m, b)
@ -433,7 +433,7 @@ func (m *Bucket) Reset() { *m = Bucket{} }
func (m *Bucket) String() string { return proto.CompactTextString(m) } func (m *Bucket) String() string { return proto.CompactTextString(m) }
func (*Bucket) ProtoMessage() {} func (*Bucket) ProtoMessage() {}
func (*Bucket) Descriptor() ([]byte, []int) { func (*Bucket) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{10} return fileDescriptor_inspector_27853f276f81267a, []int{10}
} }
func (m *Bucket) XXX_Unmarshal(b []byte) error { func (m *Bucket) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Bucket.Unmarshal(m, b) return xxx_messageInfo_Bucket.Unmarshal(m, b)
@ -471,7 +471,7 @@ func (m *BucketList) Reset() { *m = BucketList{} }
func (m *BucketList) String() string { return proto.CompactTextString(m) } func (m *BucketList) String() string { return proto.CompactTextString(m) }
func (*BucketList) ProtoMessage() {} func (*BucketList) ProtoMessage() {}
func (*BucketList) Descriptor() ([]byte, []int) { func (*BucketList) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{11} return fileDescriptor_inspector_27853f276f81267a, []int{11}
} }
func (m *BucketList) XXX_Unmarshal(b []byte) error { func (m *BucketList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BucketList.Unmarshal(m, b) return xxx_messageInfo_BucketList.Unmarshal(m, b)
@ -511,7 +511,7 @@ func (m *PingNodeRequest) Reset() { *m = PingNodeRequest{} }
func (m *PingNodeRequest) String() string { return proto.CompactTextString(m) } func (m *PingNodeRequest) String() string { return proto.CompactTextString(m) }
func (*PingNodeRequest) ProtoMessage() {} func (*PingNodeRequest) ProtoMessage() {}
func (*PingNodeRequest) Descriptor() ([]byte, []int) { func (*PingNodeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{12} return fileDescriptor_inspector_27853f276f81267a, []int{12}
} }
func (m *PingNodeRequest) XXX_Unmarshal(b []byte) error { func (m *PingNodeRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PingNodeRequest.Unmarshal(m, b) return xxx_messageInfo_PingNodeRequest.Unmarshal(m, b)
@ -549,7 +549,7 @@ func (m *PingNodeResponse) Reset() { *m = PingNodeResponse{} }
func (m *PingNodeResponse) String() string { return proto.CompactTextString(m) } func (m *PingNodeResponse) String() string { return proto.CompactTextString(m) }
func (*PingNodeResponse) ProtoMessage() {} func (*PingNodeResponse) ProtoMessage() {}
func (*PingNodeResponse) Descriptor() ([]byte, []int) { func (*PingNodeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{13} return fileDescriptor_inspector_27853f276f81267a, []int{13}
} }
func (m *PingNodeResponse) XXX_Unmarshal(b []byte) error { func (m *PingNodeResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PingNodeResponse.Unmarshal(m, b) return xxx_messageInfo_PingNodeResponse.Unmarshal(m, b)
@ -588,7 +588,7 @@ func (m *LookupNodeRequest) Reset() { *m = LookupNodeRequest{} }
func (m *LookupNodeRequest) String() string { return proto.CompactTextString(m) } func (m *LookupNodeRequest) String() string { return proto.CompactTextString(m) }
func (*LookupNodeRequest) ProtoMessage() {} func (*LookupNodeRequest) ProtoMessage() {}
func (*LookupNodeRequest) Descriptor() ([]byte, []int) { func (*LookupNodeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{14} return fileDescriptor_inspector_27853f276f81267a, []int{14}
} }
func (m *LookupNodeRequest) XXX_Unmarshal(b []byte) error { func (m *LookupNodeRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LookupNodeRequest.Unmarshal(m, b) return xxx_messageInfo_LookupNodeRequest.Unmarshal(m, b)
@ -634,7 +634,7 @@ func (m *LookupNodeResponse) Reset() { *m = LookupNodeResponse{} }
func (m *LookupNodeResponse) String() string { return proto.CompactTextString(m) } func (m *LookupNodeResponse) String() string { return proto.CompactTextString(m) }
func (*LookupNodeResponse) ProtoMessage() {} func (*LookupNodeResponse) ProtoMessage() {}
func (*LookupNodeResponse) Descriptor() ([]byte, []int) { func (*LookupNodeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_inspector_7b7fedb7046661e4, []int{15} return fileDescriptor_inspector_27853f276f81267a, []int{15}
} }
func (m *LookupNodeResponse) XXX_Unmarshal(b []byte) error { func (m *LookupNodeResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LookupNodeResponse.Unmarshal(m, b) return xxx_messageInfo_LookupNodeResponse.Unmarshal(m, b)
@ -1068,9 +1068,9 @@ var _StatDBInspector_serviceDesc = grpc.ServiceDesc{
Metadata: "inspector.proto", Metadata: "inspector.proto",
} }
func init() { proto.RegisterFile("inspector.proto", fileDescriptor_inspector_7b7fedb7046661e4) } func init() { proto.RegisterFile("inspector.proto", fileDescriptor_inspector_27853f276f81267a) }
var fileDescriptor_inspector_7b7fedb7046661e4 = []byte{ var fileDescriptor_inspector_27853f276f81267a = []byte{
// 644 bytes of a gzipped FileDescriptorProto // 644 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcb, 0x6e, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcb, 0x6e, 0xd3, 0x40,
0x14, 0xc5, 0x4e, 0x9a, 0x26, 0x37, 0x51, 0x1e, 0x93, 0x22, 0x45, 0x4e, 0x68, 0xc2, 0x2c, 0x20, 0x14, 0xc5, 0x4e, 0x9a, 0x26, 0x37, 0x51, 0x1e, 0x93, 0x22, 0x45, 0x4e, 0x68, 0xc2, 0x2c, 0x20,

View File

@ -7,6 +7,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/gogoproto"
import duration "github.com/golang/protobuf/ptypes/duration"
import ( import (
context "golang.org/x/net/context" context "golang.org/x/net/context"
@ -53,7 +54,7 @@ func (x PayerBandwidthAllocation_Action) String() string {
return proto.EnumName(PayerBandwidthAllocation_Action_name, int32(x)) return proto.EnumName(PayerBandwidthAllocation_Action_name, int32(x))
} }
func (PayerBandwidthAllocation_Action) EnumDescriptor() ([]byte, []int) { func (PayerBandwidthAllocation_Action) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{0, 0} return fileDescriptor_piecestore_664948018be76fe5, []int{0, 0}
} }
type PayerBandwidthAllocation struct { type PayerBandwidthAllocation struct {
@ -68,7 +69,7 @@ func (m *PayerBandwidthAllocation) Reset() { *m = PayerBandwidthAllocati
func (m *PayerBandwidthAllocation) String() string { return proto.CompactTextString(m) } func (m *PayerBandwidthAllocation) String() string { return proto.CompactTextString(m) }
func (*PayerBandwidthAllocation) ProtoMessage() {} func (*PayerBandwidthAllocation) ProtoMessage() {}
func (*PayerBandwidthAllocation) Descriptor() ([]byte, []int) { func (*PayerBandwidthAllocation) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{0} return fileDescriptor_piecestore_664948018be76fe5, []int{0}
} }
func (m *PayerBandwidthAllocation) XXX_Unmarshal(b []byte) error { func (m *PayerBandwidthAllocation) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PayerBandwidthAllocation.Unmarshal(m, b) return xxx_messageInfo_PayerBandwidthAllocation.Unmarshal(m, b)
@ -120,7 +121,7 @@ func (m *PayerBandwidthAllocation_Data) Reset() { *m = PayerBandwidthAll
func (m *PayerBandwidthAllocation_Data) String() string { return proto.CompactTextString(m) } func (m *PayerBandwidthAllocation_Data) String() string { return proto.CompactTextString(m) }
func (*PayerBandwidthAllocation_Data) ProtoMessage() {} func (*PayerBandwidthAllocation_Data) ProtoMessage() {}
func (*PayerBandwidthAllocation_Data) Descriptor() ([]byte, []int) { func (*PayerBandwidthAllocation_Data) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{0, 0} return fileDescriptor_piecestore_664948018be76fe5, []int{0, 0}
} }
func (m *PayerBandwidthAllocation_Data) XXX_Unmarshal(b []byte) error { func (m *PayerBandwidthAllocation_Data) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PayerBandwidthAllocation_Data.Unmarshal(m, b) return xxx_messageInfo_PayerBandwidthAllocation_Data.Unmarshal(m, b)
@ -194,7 +195,7 @@ func (m *RenterBandwidthAllocation) Reset() { *m = RenterBandwidthAlloca
func (m *RenterBandwidthAllocation) String() string { return proto.CompactTextString(m) } func (m *RenterBandwidthAllocation) String() string { return proto.CompactTextString(m) }
func (*RenterBandwidthAllocation) ProtoMessage() {} func (*RenterBandwidthAllocation) ProtoMessage() {}
func (*RenterBandwidthAllocation) Descriptor() ([]byte, []int) { func (*RenterBandwidthAllocation) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{1} return fileDescriptor_piecestore_664948018be76fe5, []int{1}
} }
func (m *RenterBandwidthAllocation) XXX_Unmarshal(b []byte) error { func (m *RenterBandwidthAllocation) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RenterBandwidthAllocation.Unmarshal(m, b) return xxx_messageInfo_RenterBandwidthAllocation.Unmarshal(m, b)
@ -241,7 +242,7 @@ func (m *RenterBandwidthAllocation_Data) Reset() { *m = RenterBandwidthA
func (m *RenterBandwidthAllocation_Data) String() string { return proto.CompactTextString(m) } func (m *RenterBandwidthAllocation_Data) String() string { return proto.CompactTextString(m) }
func (*RenterBandwidthAllocation_Data) ProtoMessage() {} func (*RenterBandwidthAllocation_Data) ProtoMessage() {}
func (*RenterBandwidthAllocation_Data) Descriptor() ([]byte, []int) { func (*RenterBandwidthAllocation_Data) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{1, 0} return fileDescriptor_piecestore_664948018be76fe5, []int{1, 0}
} }
func (m *RenterBandwidthAllocation_Data) XXX_Unmarshal(b []byte) error { func (m *RenterBandwidthAllocation_Data) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RenterBandwidthAllocation_Data.Unmarshal(m, b) return xxx_messageInfo_RenterBandwidthAllocation_Data.Unmarshal(m, b)
@ -288,7 +289,7 @@ func (m *PieceStore) Reset() { *m = PieceStore{} }
func (m *PieceStore) String() string { return proto.CompactTextString(m) } func (m *PieceStore) String() string { return proto.CompactTextString(m) }
func (*PieceStore) ProtoMessage() {} func (*PieceStore) ProtoMessage() {}
func (*PieceStore) Descriptor() ([]byte, []int) { func (*PieceStore) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{2} return fileDescriptor_piecestore_664948018be76fe5, []int{2}
} }
func (m *PieceStore) XXX_Unmarshal(b []byte) error { func (m *PieceStore) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceStore.Unmarshal(m, b) return xxx_messageInfo_PieceStore.Unmarshal(m, b)
@ -343,7 +344,7 @@ func (m *PieceStore_PieceData) Reset() { *m = PieceStore_PieceData{} }
func (m *PieceStore_PieceData) String() string { return proto.CompactTextString(m) } func (m *PieceStore_PieceData) String() string { return proto.CompactTextString(m) }
func (*PieceStore_PieceData) ProtoMessage() {} func (*PieceStore_PieceData) ProtoMessage() {}
func (*PieceStore_PieceData) Descriptor() ([]byte, []int) { func (*PieceStore_PieceData) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{2, 0} return fileDescriptor_piecestore_664948018be76fe5, []int{2, 0}
} }
func (m *PieceStore_PieceData) XXX_Unmarshal(b []byte) error { func (m *PieceStore_PieceData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceStore_PieceData.Unmarshal(m, b) return xxx_messageInfo_PieceStore_PieceData.Unmarshal(m, b)
@ -397,7 +398,7 @@ func (m *PieceId) Reset() { *m = PieceId{} }
func (m *PieceId) String() string { return proto.CompactTextString(m) } func (m *PieceId) String() string { return proto.CompactTextString(m) }
func (*PieceId) ProtoMessage() {} func (*PieceId) ProtoMessage() {}
func (*PieceId) Descriptor() ([]byte, []int) { func (*PieceId) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{3} return fileDescriptor_piecestore_664948018be76fe5, []int{3}
} }
func (m *PieceId) XXX_Unmarshal(b []byte) error { func (m *PieceId) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceId.Unmarshal(m, b) return xxx_messageInfo_PieceId.Unmarshal(m, b)
@ -444,7 +445,7 @@ func (m *PieceSummary) Reset() { *m = PieceSummary{} }
func (m *PieceSummary) String() string { return proto.CompactTextString(m) } func (m *PieceSummary) String() string { return proto.CompactTextString(m) }
func (*PieceSummary) ProtoMessage() {} func (*PieceSummary) ProtoMessage() {}
func (*PieceSummary) Descriptor() ([]byte, []int) { func (*PieceSummary) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{4} return fileDescriptor_piecestore_664948018be76fe5, []int{4}
} }
func (m *PieceSummary) XXX_Unmarshal(b []byte) error { func (m *PieceSummary) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceSummary.Unmarshal(m, b) return xxx_messageInfo_PieceSummary.Unmarshal(m, b)
@ -498,7 +499,7 @@ func (m *PieceRetrieval) Reset() { *m = PieceRetrieval{} }
func (m *PieceRetrieval) String() string { return proto.CompactTextString(m) } func (m *PieceRetrieval) String() string { return proto.CompactTextString(m) }
func (*PieceRetrieval) ProtoMessage() {} func (*PieceRetrieval) ProtoMessage() {}
func (*PieceRetrieval) Descriptor() ([]byte, []int) { func (*PieceRetrieval) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{5} return fileDescriptor_piecestore_664948018be76fe5, []int{5}
} }
func (m *PieceRetrieval) XXX_Unmarshal(b []byte) error { func (m *PieceRetrieval) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceRetrieval.Unmarshal(m, b) return xxx_messageInfo_PieceRetrieval.Unmarshal(m, b)
@ -553,7 +554,7 @@ func (m *PieceRetrieval_PieceData) Reset() { *m = PieceRetrieval_PieceDa
func (m *PieceRetrieval_PieceData) String() string { return proto.CompactTextString(m) } func (m *PieceRetrieval_PieceData) String() string { return proto.CompactTextString(m) }
func (*PieceRetrieval_PieceData) ProtoMessage() {} func (*PieceRetrieval_PieceData) ProtoMessage() {}
func (*PieceRetrieval_PieceData) Descriptor() ([]byte, []int) { func (*PieceRetrieval_PieceData) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{5, 0} return fileDescriptor_piecestore_664948018be76fe5, []int{5, 0}
} }
func (m *PieceRetrieval_PieceData) XXX_Unmarshal(b []byte) error { func (m *PieceRetrieval_PieceData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceRetrieval_PieceData.Unmarshal(m, b) return xxx_messageInfo_PieceRetrieval_PieceData.Unmarshal(m, b)
@ -606,7 +607,7 @@ func (m *PieceRetrievalStream) Reset() { *m = PieceRetrievalStream{} }
func (m *PieceRetrievalStream) String() string { return proto.CompactTextString(m) } func (m *PieceRetrievalStream) String() string { return proto.CompactTextString(m) }
func (*PieceRetrievalStream) ProtoMessage() {} func (*PieceRetrievalStream) ProtoMessage() {}
func (*PieceRetrievalStream) Descriptor() ([]byte, []int) { func (*PieceRetrievalStream) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{6} return fileDescriptor_piecestore_664948018be76fe5, []int{6}
} }
func (m *PieceRetrievalStream) XXX_Unmarshal(b []byte) error { func (m *PieceRetrievalStream) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceRetrievalStream.Unmarshal(m, b) return xxx_messageInfo_PieceRetrievalStream.Unmarshal(m, b)
@ -653,7 +654,7 @@ func (m *PieceDelete) Reset() { *m = PieceDelete{} }
func (m *PieceDelete) String() string { return proto.CompactTextString(m) } func (m *PieceDelete) String() string { return proto.CompactTextString(m) }
func (*PieceDelete) ProtoMessage() {} func (*PieceDelete) ProtoMessage() {}
func (*PieceDelete) Descriptor() ([]byte, []int) { func (*PieceDelete) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{7} return fileDescriptor_piecestore_664948018be76fe5, []int{7}
} }
func (m *PieceDelete) XXX_Unmarshal(b []byte) error { func (m *PieceDelete) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceDelete.Unmarshal(m, b) return xxx_messageInfo_PieceDelete.Unmarshal(m, b)
@ -698,7 +699,7 @@ func (m *PieceDeleteSummary) Reset() { *m = PieceDeleteSummary{} }
func (m *PieceDeleteSummary) String() string { return proto.CompactTextString(m) } func (m *PieceDeleteSummary) String() string { return proto.CompactTextString(m) }
func (*PieceDeleteSummary) ProtoMessage() {} func (*PieceDeleteSummary) ProtoMessage() {}
func (*PieceDeleteSummary) Descriptor() ([]byte, []int) { func (*PieceDeleteSummary) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{8} return fileDescriptor_piecestore_664948018be76fe5, []int{8}
} }
func (m *PieceDeleteSummary) XXX_Unmarshal(b []byte) error { func (m *PieceDeleteSummary) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceDeleteSummary.Unmarshal(m, b) return xxx_messageInfo_PieceDeleteSummary.Unmarshal(m, b)
@ -737,7 +738,7 @@ func (m *PieceStoreSummary) Reset() { *m = PieceStoreSummary{} }
func (m *PieceStoreSummary) String() string { return proto.CompactTextString(m) } func (m *PieceStoreSummary) String() string { return proto.CompactTextString(m) }
func (*PieceStoreSummary) ProtoMessage() {} func (*PieceStoreSummary) ProtoMessage() {}
func (*PieceStoreSummary) Descriptor() ([]byte, []int) { func (*PieceStoreSummary) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{9} return fileDescriptor_piecestore_664948018be76fe5, []int{9}
} }
func (m *PieceStoreSummary) XXX_Unmarshal(b []byte) error { func (m *PieceStoreSummary) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PieceStoreSummary.Unmarshal(m, b) return xxx_messageInfo_PieceStoreSummary.Unmarshal(m, b)
@ -781,7 +782,7 @@ func (m *StatsReq) Reset() { *m = StatsReq{} }
func (m *StatsReq) String() string { return proto.CompactTextString(m) } func (m *StatsReq) String() string { return proto.CompactTextString(m) }
func (*StatsReq) ProtoMessage() {} func (*StatsReq) ProtoMessage() {}
func (*StatsReq) Descriptor() ([]byte, []int) { func (*StatsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{10} return fileDescriptor_piecestore_664948018be76fe5, []int{10}
} }
func (m *StatsReq) XXX_Unmarshal(b []byte) error { func (m *StatsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StatsReq.Unmarshal(m, b) return xxx_messageInfo_StatsReq.Unmarshal(m, b)
@ -815,7 +816,7 @@ func (m *StatSummary) Reset() { *m = StatSummary{} }
func (m *StatSummary) String() string { return proto.CompactTextString(m) } func (m *StatSummary) String() string { return proto.CompactTextString(m) }
func (*StatSummary) ProtoMessage() {} func (*StatSummary) ProtoMessage() {}
func (*StatSummary) Descriptor() ([]byte, []int) { func (*StatSummary) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{11} return fileDescriptor_piecestore_664948018be76fe5, []int{11}
} }
func (m *StatSummary) XXX_Unmarshal(b []byte) error { func (m *StatSummary) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StatSummary.Unmarshal(m, b) return xxx_messageInfo_StatSummary.Unmarshal(m, b)
@ -876,7 +877,7 @@ func (m *SignedMessage) Reset() { *m = SignedMessage{} }
func (m *SignedMessage) String() string { return proto.CompactTextString(m) } func (m *SignedMessage) String() string { return proto.CompactTextString(m) }
func (*SignedMessage) ProtoMessage() {} func (*SignedMessage) ProtoMessage() {}
func (*SignedMessage) Descriptor() ([]byte, []int) { func (*SignedMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_494b76725f4df406, []int{12} return fileDescriptor_piecestore_664948018be76fe5, []int{12}
} }
func (m *SignedMessage) XXX_Unmarshal(b []byte) error { func (m *SignedMessage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SignedMessage.Unmarshal(m, b) return xxx_messageInfo_SignedMessage.Unmarshal(m, b)
@ -917,6 +918,114 @@ func (m *SignedMessage) GetPublicKey() []byte {
return nil return nil
} }
type DashboardReq struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DashboardReq) Reset() { *m = DashboardReq{} }
func (m *DashboardReq) String() string { return proto.CompactTextString(m) }
func (*DashboardReq) ProtoMessage() {}
func (*DashboardReq) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_664948018be76fe5, []int{13}
}
func (m *DashboardReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DashboardReq.Unmarshal(m, b)
}
func (m *DashboardReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DashboardReq.Marshal(b, m, deterministic)
}
func (dst *DashboardReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_DashboardReq.Merge(dst, src)
}
func (m *DashboardReq) XXX_Size() int {
return xxx_messageInfo_DashboardReq.Size(m)
}
func (m *DashboardReq) XXX_DiscardUnknown() {
xxx_messageInfo_DashboardReq.DiscardUnknown(m)
}
var xxx_messageInfo_DashboardReq proto.InternalMessageInfo
type DashboardStats struct {
NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
NodeConnections int64 `protobuf:"varint,2,opt,name=node_connections,json=nodeConnections,proto3" json:"node_connections,omitempty"`
Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
Stats *StatSummary `protobuf:"bytes,4,opt,name=stats" json:"stats,omitempty"`
Connection bool `protobuf:"varint,5,opt,name=connection,proto3" json:"connection,omitempty"`
Uptime *duration.Duration `protobuf:"bytes,6,opt,name=uptime" json:"uptime,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DashboardStats) Reset() { *m = DashboardStats{} }
func (m *DashboardStats) String() string { return proto.CompactTextString(m) }
func (*DashboardStats) ProtoMessage() {}
func (*DashboardStats) Descriptor() ([]byte, []int) {
return fileDescriptor_piecestore_664948018be76fe5, []int{14}
}
func (m *DashboardStats) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DashboardStats.Unmarshal(m, b)
}
func (m *DashboardStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DashboardStats.Marshal(b, m, deterministic)
}
func (dst *DashboardStats) XXX_Merge(src proto.Message) {
xxx_messageInfo_DashboardStats.Merge(dst, src)
}
func (m *DashboardStats) XXX_Size() int {
return xxx_messageInfo_DashboardStats.Size(m)
}
func (m *DashboardStats) XXX_DiscardUnknown() {
xxx_messageInfo_DashboardStats.DiscardUnknown(m)
}
var xxx_messageInfo_DashboardStats proto.InternalMessageInfo
func (m *DashboardStats) GetNodeId() string {
if m != nil {
return m.NodeId
}
return ""
}
func (m *DashboardStats) GetNodeConnections() int64 {
if m != nil {
return m.NodeConnections
}
return 0
}
func (m *DashboardStats) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
func (m *DashboardStats) GetStats() *StatSummary {
if m != nil {
return m.Stats
}
return nil
}
func (m *DashboardStats) GetConnection() bool {
if m != nil {
return m.Connection
}
return false
}
func (m *DashboardStats) GetUptime() *duration.Duration {
if m != nil {
return m.Uptime
}
return nil
}
func init() { func init() {
proto.RegisterType((*PayerBandwidthAllocation)(nil), "piecestoreroutes.PayerBandwidthAllocation") proto.RegisterType((*PayerBandwidthAllocation)(nil), "piecestoreroutes.PayerBandwidthAllocation")
proto.RegisterType((*PayerBandwidthAllocation_Data)(nil), "piecestoreroutes.PayerBandwidthAllocation.Data") proto.RegisterType((*PayerBandwidthAllocation_Data)(nil), "piecestoreroutes.PayerBandwidthAllocation.Data")
@ -935,6 +1044,8 @@ func init() {
proto.RegisterType((*StatsReq)(nil), "piecestoreroutes.StatsReq") proto.RegisterType((*StatsReq)(nil), "piecestoreroutes.StatsReq")
proto.RegisterType((*StatSummary)(nil), "piecestoreroutes.StatSummary") proto.RegisterType((*StatSummary)(nil), "piecestoreroutes.StatSummary")
proto.RegisterType((*SignedMessage)(nil), "piecestoreroutes.SignedMessage") proto.RegisterType((*SignedMessage)(nil), "piecestoreroutes.SignedMessage")
proto.RegisterType((*DashboardReq)(nil), "piecestoreroutes.DashboardReq")
proto.RegisterType((*DashboardStats)(nil), "piecestoreroutes.DashboardStats")
proto.RegisterEnum("piecestoreroutes.PayerBandwidthAllocation_Action", PayerBandwidthAllocation_Action_name, PayerBandwidthAllocation_Action_value) proto.RegisterEnum("piecestoreroutes.PayerBandwidthAllocation_Action", PayerBandwidthAllocation_Action_name, PayerBandwidthAllocation_Action_value)
} }
@ -955,6 +1066,7 @@ type PieceStoreRoutesClient interface {
Store(ctx context.Context, opts ...grpc.CallOption) (PieceStoreRoutes_StoreClient, error) Store(ctx context.Context, opts ...grpc.CallOption) (PieceStoreRoutes_StoreClient, error)
Delete(ctx context.Context, in *PieceDelete, opts ...grpc.CallOption) (*PieceDeleteSummary, error) Delete(ctx context.Context, in *PieceDelete, opts ...grpc.CallOption) (*PieceDeleteSummary, error)
Stats(ctx context.Context, in *StatsReq, opts ...grpc.CallOption) (*StatSummary, error) Stats(ctx context.Context, in *StatsReq, opts ...grpc.CallOption) (*StatSummary, error)
Dashboard(ctx context.Context, in *DashboardReq, opts ...grpc.CallOption) (PieceStoreRoutes_DashboardClient, error)
} }
type pieceStoreRoutesClient struct { type pieceStoreRoutesClient struct {
@ -1057,6 +1169,38 @@ func (c *pieceStoreRoutesClient) Stats(ctx context.Context, in *StatsReq, opts .
return out, nil return out, nil
} }
func (c *pieceStoreRoutesClient) Dashboard(ctx context.Context, in *DashboardReq, opts ...grpc.CallOption) (PieceStoreRoutes_DashboardClient, error) {
stream, err := c.cc.NewStream(ctx, &_PieceStoreRoutes_serviceDesc.Streams[2], "/piecestoreroutes.PieceStoreRoutes/Dashboard", opts...)
if err != nil {
return nil, err
}
x := &pieceStoreRoutesDashboardClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type PieceStoreRoutes_DashboardClient interface {
Recv() (*DashboardStats, error)
grpc.ClientStream
}
type pieceStoreRoutesDashboardClient struct {
grpc.ClientStream
}
func (x *pieceStoreRoutesDashboardClient) Recv() (*DashboardStats, error) {
m := new(DashboardStats)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// PieceStoreRoutesServer is the server API for PieceStoreRoutes service. // PieceStoreRoutesServer is the server API for PieceStoreRoutes service.
type PieceStoreRoutesServer interface { type PieceStoreRoutesServer interface {
Piece(context.Context, *PieceId) (*PieceSummary, error) Piece(context.Context, *PieceId) (*PieceSummary, error)
@ -1064,6 +1208,7 @@ type PieceStoreRoutesServer interface {
Store(PieceStoreRoutes_StoreServer) error Store(PieceStoreRoutes_StoreServer) error
Delete(context.Context, *PieceDelete) (*PieceDeleteSummary, error) Delete(context.Context, *PieceDelete) (*PieceDeleteSummary, error)
Stats(context.Context, *StatsReq) (*StatSummary, error) Stats(context.Context, *StatsReq) (*StatSummary, error)
Dashboard(*DashboardReq, PieceStoreRoutes_DashboardServer) error
} }
func RegisterPieceStoreRoutesServer(s *grpc.Server, srv PieceStoreRoutesServer) { func RegisterPieceStoreRoutesServer(s *grpc.Server, srv PieceStoreRoutesServer) {
@ -1176,6 +1321,27 @@ func _PieceStoreRoutes_Stats_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _PieceStoreRoutes_Dashboard_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(DashboardReq)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(PieceStoreRoutesServer).Dashboard(m, &pieceStoreRoutesDashboardServer{stream})
}
type PieceStoreRoutes_DashboardServer interface {
Send(*DashboardStats) error
grpc.ServerStream
}
type pieceStoreRoutesDashboardServer struct {
grpc.ServerStream
}
func (x *pieceStoreRoutesDashboardServer) Send(m *DashboardStats) error {
return x.ServerStream.SendMsg(m)
}
var _PieceStoreRoutes_serviceDesc = grpc.ServiceDesc{ var _PieceStoreRoutes_serviceDesc = grpc.ServiceDesc{
ServiceName: "piecestoreroutes.PieceStoreRoutes", ServiceName: "piecestoreroutes.PieceStoreRoutes",
HandlerType: (*PieceStoreRoutesServer)(nil), HandlerType: (*PieceStoreRoutesServer)(nil),
@ -1205,73 +1371,88 @@ var _PieceStoreRoutes_serviceDesc = grpc.ServiceDesc{
Handler: _PieceStoreRoutes_Store_Handler, Handler: _PieceStoreRoutes_Store_Handler,
ClientStreams: true, ClientStreams: true,
}, },
{
StreamName: "Dashboard",
Handler: _PieceStoreRoutes_Dashboard_Handler,
ServerStreams: true,
},
}, },
Metadata: "piecestore.proto", Metadata: "piecestore.proto",
} }
func init() { proto.RegisterFile("piecestore.proto", fileDescriptor_piecestore_494b76725f4df406) } func init() { proto.RegisterFile("piecestore.proto", fileDescriptor_piecestore_664948018be76fe5) }
var fileDescriptor_piecestore_494b76725f4df406 = []byte{ var fileDescriptor_piecestore_664948018be76fe5 = []byte{
// 972 bytes of a gzipped FileDescriptorProto // 1130 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xdb, 0x46, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4b, 0x6f, 0xdb, 0xc6,
0x10, 0x36, 0x49, 0x5b, 0xb2, 0xc6, 0x96, 0xac, 0xac, 0x8d, 0x96, 0x16, 0xe2, 0xda, 0x60, 0x9a, 0x13, 0x17, 0x29, 0x5b, 0x8f, 0x91, 0x25, 0x2b, 0x9b, 0xe0, 0xff, 0x97, 0x85, 0xd8, 0x16, 0x98,
0x54, 0x48, 0x00, 0xb5, 0x71, 0x81, 0xde, 0x6d, 0x58, 0x08, 0x88, 0xa0, 0x8e, 0xb0, 0x92, 0x2e, 0x26, 0x55, 0x13, 0x40, 0x8e, 0x15, 0xa0, 0x77, 0xbb, 0x32, 0x02, 0xa1, 0xa8, 0xe3, 0xae, 0xec,
0x39, 0x94, 0x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, 0xf9, 0x2b, 0xa9, 0xf5, 0xb7, 0x7a, 0xea, 0xbb,
0xd7, 0x4b, 0xbf, 0x7b, 0xbd, 0x41, 0xf2, 0xdd, 0xa3, 0x89, 0x63, 0xff, 0x8f, 0x22, 0x34, 0x73,
0xf6, 0x51, 0x99, 0x9a, 0x0c, 0x60, 0x5d, 0xea, 0xc8, 0xd6, 0x92, 0x37, 0x65, 0x68, 0xb7, 0x77,
0x96, 0xcd, 0x29, 0x55, 0xb2, 0x51, 0x20, 0x6f, 0xa1, 0x92, 0x74, 0x2e, 0x92, 0xce, 0x7d, 0x8f,
0x53, 0xfb, 0xd9, 0x7d, 0x1e, 0xaa, 0xf9, 0x8d, 0x42, 0x57, 0x7b, 0xa9, 0x91, 0x63, 0x58, 0x57,
0x23, 0xfa, 0xf1, 0xaa, 0x71, 0xd9, 0x7e, 0xb2, 0xca, 0x9a, 0x55, 0xda, 0xd5, 0xc8, 0x1b, 0x28,
0x25, 0x8f, 0xc2, 0xf6, 0x92, 0x2d, 0xca, 0xdc, 0xfe, 0x6c, 0xa5, 0x39, 0x3f, 0xfc, 0x40, 0x14,
0x28, 0xee, 0xac, 0xbd, 0xf8, 0x66, 0x45, 0x5f, 0xb6, 0x57, 0xdf, 0xba, 0x51, 0x20, 0xdf, 0x42,
0x35, 0x63, 0x25, 0x59, 0x80, 0xf8, 0x2c, 0x87, 0xdb, 0x9d, 0x15, 0x76, 0x99, 0xd2, 0x28, 0xbc,
0xd4, 0x0e, 0xd7, 0xde, 0xea, 0xc1, 0x78, 0x5c, 0x92, 0x8c, 0x78, 0xf5, 0x4f, 0x00, 0x00, 0x00,
0xff, 0xff, 0x14, 0xe3, 0x9c, 0x65, 0x4c, 0x0c, 0x00, 0x00,
} }

View File

@ -39,6 +39,11 @@ func (m *MockPieceStoreRoutesClient) EXPECT() *MockPieceStoreRoutesClientMockRec
return m.recorder return m.recorder
} }
// Dashboard returns an object that mocks out the dashboard calls to pass tests
func (m *MockPieceStoreRoutesClient) Dashboard(ctx context.Context, req *DashboardReq, opts ...grpc.CallOption) (PieceStoreRoutes_DashboardClient, error) {
return nil, nil
}
// Delete mocks base method // Delete mocks base method
func (m *MockPieceStoreRoutesClient) Delete(arg0 context.Context, arg1 *PieceDelete, arg2 ...grpc.CallOption) (*PieceDeleteSummary, error) { func (m *MockPieceStoreRoutesClient) Delete(arg0 context.Context, arg1 *PieceDelete, arg2 ...grpc.CallOption) (*PieceDeleteSummary, error) {
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}

View File

@ -6,7 +6,9 @@ option go_package = "pb";
package piecestoreroutes; package piecestoreroutes;
import "node.proto";
import "gogo.proto"; import "gogo.proto";
import "google/protobuf/duration.proto";
service PieceStoreRoutes { service PieceStoreRoutes {
rpc Piece(PieceId) returns (PieceSummary) {} rpc Piece(PieceId) returns (PieceSummary) {}
@ -18,6 +20,8 @@ service PieceStoreRoutes {
rpc Delete(PieceDelete) returns (PieceDeleteSummary) {} rpc Delete(PieceDelete) returns (PieceDeleteSummary) {}
rpc Stats(StatsReq) returns (StatSummary) {} rpc Stats(StatsReq) returns (StatSummary) {}
rpc Dashboard(DashboardReq) returns (stream DashboardStats) {}
} }
message PayerBandwidthAllocation { // Payer refers to satellite message PayerBandwidthAllocation { // Payer refers to satellite
@ -128,4 +132,15 @@ message SignedMessage {
bytes data = 1; bytes data = 1;
bytes signature = 2; bytes signature = 2;
bytes public_key = 3; bytes public_key = 3;
} }
message DashboardReq { }
message DashboardStats {
string node_id = 1;
int64 node_connections = 2;
string address = 3;
StatSummary stats = 4;
bool connection = 5;
google.protobuf.Duration uptime = 6;
}

View File

@ -48,7 +48,6 @@ type Client interface {
Put(ctx context.Context, id PieceID, data io.Reader, ttl time.Time, ba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) error Put(ctx context.Context, id PieceID, data io.Reader, ttl time.Time, ba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) error
Get(ctx context.Context, id PieceID, size int64, ba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (ranger.Ranger, error) Get(ctx context.Context, id PieceID, size int64, ba *pb.PayerBandwidthAllocation, authorization *pb.SignedMessage) (ranger.Ranger, error)
Delete(ctx context.Context, pieceID PieceID, authorization *pb.SignedMessage) error Delete(ctx context.Context, pieceID PieceID, authorization *pb.SignedMessage) error
Stats(ctx context.Context) (*pb.StatSummary, error)
io.Closer io.Closer
} }
@ -184,11 +183,6 @@ func (ps *PieceStore) Delete(ctx context.Context, id PieceID, authorization *pb.
return nil return nil
} }
// Stats will retrieve stats about a piece storage node
func (ps *PieceStore) Stats(ctx context.Context) (*pb.StatSummary, error) {
return ps.client.Stats(ctx, &pb.StatsReq{})
}
// sign a message using the clients private key // sign a message using the clients private key
func (ps *PieceStore) sign(msg []byte) (signature []byte, err error) { func (ps *PieceStore) sign(msg []byte) (signature []byte, err error) {
if ps.prikey == nil { if ps.prikey == nil {

View File

@ -0,0 +1,64 @@
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package psclient
import (
"context"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/provider"
"storj.io/storj/pkg/transport"
)
// LiteClient is the lightweight client for getting stats
type LiteClient interface {
Stats(ctx context.Context) (*pb.StatSummary, error)
Dashboard(ctx context.Context) (pb.PieceStoreRoutes_DashboardClient, error)
}
// PieceStoreLite is the struct that holds the client
type PieceStoreLite struct {
client pb.PieceStoreRoutesClient
}
// Dashboard returns a simple terminal dashboard displaying info
func (psl *PieceStoreLite) Dashboard(ctx context.Context) (pb.PieceStoreRoutes_DashboardClient, error) {
return psl.client.Dashboard(ctx, &pb.DashboardReq{})
}
// Stats will retrieve stats about a piece storage node
func (psl *PieceStoreLite) Stats(ctx context.Context) (*pb.StatSummary, error) {
return psl.client.Stats(ctx, &pb.StatsReq{})
}
// NewLiteClient returns a new LiteClient
func NewLiteClient(ctx context.Context, addr string) (LiteClient, error) {
clientIdent, err := provider.NewFullIdentity(ctx, 12, 4)
if err != nil {
return nil, err
}
// address of node to create client connection
if addr == "" {
addr = ":7777"
}
tc := transport.NewClient(clientIdent)
n := &pb.Node{
Address: &pb.NodeAddress{
Address: addr,
Transport: 0,
},
Type: pb.NodeType_STORAGE,
}
conn, err := tc.DialNode(ctx, n)
if err != nil {
return nil, err
}
return &PieceStoreLite{
client: pb.NewPieceStoreRoutesClient(conn),
}, nil
}

View File

@ -48,18 +48,19 @@ func (c Config) Run(ctx context.Context, server *provider.Provider) (err error)
return ServerError.Wrap(err) return ServerError.Wrap(err)
} }
s, err := NewEndpoint(zap.L(), c, storage, db, server.Identity().Key) //kademlia
kad := kademlia.LoadFromContext(ctx)
if kad == nil {
return ServerError.New("Failed to load Kademlia from context")
}
s, err := NewEndpoint(zap.L(), c, storage, db, server.Identity().Key, kad)
if err != nil { if err != nil {
return err return err
} }
pb.RegisterPieceStoreRoutesServer(server.GRPC(), s) pb.RegisterPieceStoreRoutesServer(server.GRPC(), s)
//kademlia rt, err := kad.GetRoutingTable(ctx)
k := kademlia.LoadFromContext(ctx)
if k == nil {
return ServerError.New("Failed to load Kademlia from context")
}
rt, err := k.GetRoutingTable(ctx)
if err != nil { if err != nil {
return ServerError.Wrap(err) return ServerError.Wrap(err)
} }
@ -75,7 +76,7 @@ func (c Config) Run(ctx context.Context, server *provider.Provider) (err error)
}() }()
//agreementsender //agreementsender
agreementSender := agreementsender.New(zap.L(), s.DB, server.Identity(), k, c.AgreementSenderCheckInterval) agreementSender := agreementsender.New(zap.L(), s.DB, server.Identity(), kad, c.AgreementSenderCheckInterval)
go agreementSender.Run(ctx) go agreementSender.Run(ctx)
defer func() { log.Fatal(s.Stop(ctx)) }() defer func() { log.Fatal(s.Stop(ctx)) }()

View File

@ -16,6 +16,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/golang/protobuf/ptypes"
"github.com/gtank/cryptopasta" "github.com/gtank/cryptopasta"
"github.com/mr-tron/base58/base58" "github.com/mr-tron/base58/base58"
"github.com/shirou/gopsutil/disk" "github.com/shirou/gopsutil/disk"
@ -24,6 +25,7 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
"storj.io/storj/pkg/auth" "storj.io/storj/pkg/auth"
"storj.io/storj/pkg/kademlia"
"storj.io/storj/pkg/pb" "storj.io/storj/pkg/pb"
"storj.io/storj/pkg/peertls" "storj.io/storj/pkg/peertls"
pstore "storj.io/storj/pkg/piecestore" pstore "storj.io/storj/pkg/piecestore"
@ -56,6 +58,7 @@ func DirSize(path string) (int64, error) {
// Server -- GRPC server meta data used in route calls // Server -- GRPC server meta data used in route calls
type Server struct { type Server struct {
startTime time.Time
log *zap.Logger log *zap.Logger
storage *pstore.Storage storage *pstore.Storage
DB *psdb.DB DB *psdb.DB
@ -63,10 +66,11 @@ type Server struct {
totalAllocated int64 totalAllocated int64
totalBwAllocated int64 totalBwAllocated int64
verifier auth.SignedMessageVerifier verifier auth.SignedMessageVerifier
kad *kademlia.Kademlia
} }
// NewEndpoint -- initializes a new endpoint for a piecestore server // NewEndpoint -- initializes a new endpoint for a piecestore server
func NewEndpoint(log *zap.Logger, config Config, storage *pstore.Storage, db *psdb.DB, pkey crypto.PrivateKey) (*Server, error) { func NewEndpoint(log *zap.Logger, config Config, storage *pstore.Storage, db *psdb.DB, pkey crypto.PrivateKey, k *kademlia.Kademlia) (*Server, error) {
// read the allocated disk space from the config file // read the allocated disk space from the config file
allocatedDiskSpace := config.AllocatedDiskSpace.Int64() allocatedDiskSpace := config.AllocatedDiskSpace.Int64()
allocatedBandwidth := config.AllocatedBandwidth.Int64() allocatedBandwidth := config.AllocatedBandwidth.Int64()
@ -120,6 +124,7 @@ func NewEndpoint(log *zap.Logger, config Config, storage *pstore.Storage, db *ps
} }
return &Server{ return &Server{
startTime: time.Now(),
log: log, log: log,
storage: storage, storage: storage,
DB: db, DB: db,
@ -127,6 +132,7 @@ func NewEndpoint(log *zap.Logger, config Config, storage *pstore.Storage, db *ps
totalAllocated: allocatedDiskSpace, totalAllocated: allocatedDiskSpace,
totalBwAllocated: allocatedBandwidth, totalBwAllocated: allocatedBandwidth,
verifier: auth.NewSignedMessageVerifier(), verifier: auth.NewSignedMessageVerifier(),
kad: k,
}, nil }, nil
} }
@ -214,6 +220,30 @@ func (s *Server) Stats(ctx context.Context, in *pb.StatsReq) (*pb.StatSummary, e
return &pb.StatSummary{UsedSpace: totalUsed, AvailableSpace: (s.totalAllocated - totalUsed), UsedBandwidth: totalUsedBandwidth, AvailableBandwidth: (s.totalBwAllocated - totalUsedBandwidth)}, nil return &pb.StatSummary{UsedSpace: totalUsed, AvailableSpace: (s.totalAllocated - totalUsed), UsedBandwidth: totalUsedBandwidth, AvailableBandwidth: (s.totalBwAllocated - totalUsedBandwidth)}, nil
} }
// Dashboard is a stream that sends data every `interval` seconds to the listener.
func (s *Server) Dashboard(in *pb.DashboardReq, stream pb.PieceStoreRoutes_DashboardServer) (err error) {
ctx := stream.Context()
ticker := time.NewTicker(3 * time.Second)
for {
select {
case <-ctx.Done():
return ctx.Err()
case <-ticker.C:
data, err := s.getDashboardData(ctx)
if err != nil {
s.log.Warn("unable to create dashboard data proto")
continue
}
if err := stream.Send(data); err != nil {
s.log.Error("error sending dashboard stream", zap.Error(err))
return err
}
}
}
}
// Delete -- Delete data by Id from piecestore // Delete -- Delete data by Id from piecestore
func (s *Server) Delete(ctx context.Context, in *pb.PieceDelete) (*pb.PieceDeleteSummary, error) { func (s *Server) Delete(ctx context.Context, in *pb.PieceDelete) (*pb.PieceDeleteSummary, error) {
s.log.Debug("Deleting", zap.String("Piece ID", fmt.Sprint(in.GetId()))) s.log.Debug("Deleting", zap.String("Piece ID", fmt.Sprint(in.GetId())))
@ -301,3 +331,29 @@ func getNamespacedPieceID(pieceID, namespace []byte) (string, error) {
func getNamespace(signedMessage *pb.SignedMessage) []byte { func getNamespace(signedMessage *pb.SignedMessage) []byte {
return signedMessage.GetData() return signedMessage.GetData()
} }
func (s *Server) getDashboardData(ctx context.Context) (*pb.DashboardStats, error) {
statsSummary, err := s.Stats(ctx, &pb.StatsReq{})
if err != nil {
return &pb.DashboardStats{}, ServerError.Wrap(err)
}
rt, err := s.kad.GetRoutingTable(ctx)
if err != nil {
return &pb.DashboardStats{}, ServerError.Wrap(err)
}
nodes, err := s.kad.GetNodes(ctx, rt.Local().Id, 10000)
if err != nil {
return &pb.DashboardStats{}, ServerError.Wrap(err)
}
return &pb.DashboardStats{
NodeId: rt.Local().Id.String(),
NodeConnections: int64(len(nodes)),
Address: "",
Connection: true,
Uptime: ptypes.DurationProto(time.Since(s.startTime)),
Stats: statsSummary,
}, nil
}