storagenode/internalpb: move gracefulexit.proto
Change-Id: Ia3614846ed49a39c8f39331516d16d45a695240b
This commit is contained in:
parent
cda67a659a
commit
1903b15474
@ -17,12 +17,12 @@ import (
|
||||
"go.uber.org/zap"
|
||||
|
||||
"storj.io/common/memory"
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/rpc"
|
||||
"storj.io/common/storj"
|
||||
"storj.io/private/process"
|
||||
"storj.io/storj/private/date"
|
||||
"storj.io/storj/private/prompt"
|
||||
"storj.io/storj/storagenode/internalpb"
|
||||
)
|
||||
|
||||
type gracefulExitClient struct {
|
||||
@ -42,20 +42,20 @@ func dialGracefulExitClient(ctx context.Context, address string) (*gracefulExitC
|
||||
return &gracefulExitClient{conn: conn}, nil
|
||||
}
|
||||
|
||||
func (client *gracefulExitClient) getNonExitingSatellites(ctx context.Context) (*pb.GetNonExitingSatellitesResponse, error) {
|
||||
return pb.NewDRPCNodeGracefulExitClient(client.conn).GetNonExitingSatellites(ctx, &pb.GetNonExitingSatellitesRequest{})
|
||||
func (client *gracefulExitClient) getNonExitingSatellites(ctx context.Context) (*internalpb.GetNonExitingSatellitesResponse, error) {
|
||||
return internalpb.NewDRPCNodeGracefulExitClient(client.conn).GetNonExitingSatellites(ctx, &internalpb.GetNonExitingSatellitesRequest{})
|
||||
}
|
||||
|
||||
func (client *gracefulExitClient) initGracefulExit(ctx context.Context, req *pb.InitiateGracefulExitRequest) (*pb.ExitProgress, error) {
|
||||
return pb.NewDRPCNodeGracefulExitClient(client.conn).InitiateGracefulExit(ctx, req)
|
||||
func (client *gracefulExitClient) initGracefulExit(ctx context.Context, req *internalpb.InitiateGracefulExitRequest) (*internalpb.ExitProgress, error) {
|
||||
return internalpb.NewDRPCNodeGracefulExitClient(client.conn).InitiateGracefulExit(ctx, req)
|
||||
}
|
||||
|
||||
func (client *gracefulExitClient) getExitProgress(ctx context.Context) (*pb.GetExitProgressResponse, error) {
|
||||
return pb.NewDRPCNodeGracefulExitClient(client.conn).GetExitProgress(ctx, &pb.GetExitProgressRequest{})
|
||||
func (client *gracefulExitClient) getExitProgress(ctx context.Context) (*internalpb.GetExitProgressResponse, error) {
|
||||
return internalpb.NewDRPCNodeGracefulExitClient(client.conn).GetExitProgress(ctx, &internalpb.GetExitProgressRequest{})
|
||||
}
|
||||
|
||||
func (client *gracefulExitClient) gracefulExitFeasibility(ctx context.Context, id storj.NodeID) (*pb.GracefulExitFeasibilityResponse, error) {
|
||||
return pb.NewDRPCNodeGracefulExitClient(client.conn).GracefulExitFeasibility(ctx, &pb.GracefulExitFeasibilityNodeRequest{NodeId: id})
|
||||
func (client *gracefulExitClient) gracefulExitFeasibility(ctx context.Context, id storj.NodeID) (*internalpb.GracefulExitFeasibilityResponse, error) {
|
||||
return internalpb.NewDRPCNodeGracefulExitClient(client.conn).GracefulExitFeasibility(ctx, &internalpb.GracefulExitFeasibilityRequest{NodeId: id})
|
||||
}
|
||||
|
||||
func (client *gracefulExitClient) close() error {
|
||||
@ -185,7 +185,7 @@ func cmdGracefulExitStatus(cmd *cobra.Command, args []string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func displayExitProgress(w io.Writer, progresses []*pb.ExitProgress) {
|
||||
func displayExitProgress(w io.Writer, progresses []*internalpb.ExitProgress) {
|
||||
fmt.Fprintln(w, "\nDomain Name\tNode ID\tPercent Complete\tSuccessful\tCompletion Receipt")
|
||||
|
||||
for _, progress := range progresses {
|
||||
@ -229,10 +229,10 @@ func gracefulExitInit(ctx context.Context, satelliteIDs []storj.NodeID, w *tabwr
|
||||
}
|
||||
|
||||
// save satellites for graceful exit into the db
|
||||
progresses := make([]*pb.ExitProgress, 0, len(satelliteIDs))
|
||||
progresses := make([]*internalpb.ExitProgress, 0, len(satelliteIDs))
|
||||
var errgroup errs.Group
|
||||
for _, id := range satelliteIDs {
|
||||
req := &pb.InitiateGracefulExitRequest{
|
||||
req := &internalpb.InitiateGracefulExitRequest{
|
||||
NodeId: id,
|
||||
}
|
||||
resp, err := client.initGracefulExit(ctx, req)
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/rpc"
|
||||
"storj.io/common/rpc/rpcstatus"
|
||||
"storj.io/storj/storagenode/internalpb"
|
||||
"storj.io/storj/storagenode/pieces"
|
||||
"storj.io/storj/storagenode/satellites"
|
||||
"storj.io/storj/storagenode/trust"
|
||||
@ -39,12 +40,12 @@ func NewEndpoint(log *zap.Logger, trust *trust.Pool, satellites satellites.DB, d
|
||||
}
|
||||
|
||||
// GetNonExitingSatellites returns a list of satellites that the storagenode has not begun a graceful exit for.
|
||||
func (e *Endpoint) GetNonExitingSatellites(ctx context.Context, req *pb.GetNonExitingSatellitesRequest) (*pb.GetNonExitingSatellitesResponse, error) {
|
||||
func (e *Endpoint) GetNonExitingSatellites(ctx context.Context, req *internalpb.GetNonExitingSatellitesRequest) (*internalpb.GetNonExitingSatellitesResponse, error) {
|
||||
e.log.Debug("initialize graceful exit: GetSatellitesList")
|
||||
// get all trusted satellites
|
||||
trustedSatellites := e.trust.GetSatellites(ctx)
|
||||
|
||||
availableSatellites := make([]*pb.NonExitingSatellite, 0, len(trustedSatellites))
|
||||
availableSatellites := make([]*internalpb.NonExitingSatellite, 0, len(trustedSatellites))
|
||||
|
||||
// filter out satellites that are already exiting
|
||||
exitingSatellites, err := e.satellites.ListGracefulExits(ctx)
|
||||
@ -77,20 +78,20 @@ func (e *Endpoint) GetNonExitingSatellites(ctx context.Context, req *pb.GetNonEx
|
||||
e.log.Debug("graceful exit: get space used by satellite", zap.Stringer("Satellite ID", trusted), zap.Error(err))
|
||||
continue
|
||||
}
|
||||
availableSatellites = append(availableSatellites, &pb.NonExitingSatellite{
|
||||
availableSatellites = append(availableSatellites, &internalpb.NonExitingSatellite{
|
||||
DomainName: nodeurl.Address,
|
||||
NodeId: trusted,
|
||||
SpaceUsed: float64(piecesContentSize),
|
||||
})
|
||||
}
|
||||
|
||||
return &pb.GetNonExitingSatellitesResponse{
|
||||
return &internalpb.GetNonExitingSatellitesResponse{
|
||||
Satellites: availableSatellites,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// InitiateGracefulExit updates one or more satellites in the storagenode's database to be gracefully exiting.
|
||||
func (e *Endpoint) InitiateGracefulExit(ctx context.Context, req *pb.InitiateGracefulExitRequest) (*pb.ExitProgress, error) {
|
||||
func (e *Endpoint) InitiateGracefulExit(ctx context.Context, req *internalpb.InitiateGracefulExitRequest) (*internalpb.ExitProgress, error) {
|
||||
e.log.Debug("initialize graceful exit: start", zap.Stringer("Satellite ID", req.NodeId))
|
||||
|
||||
nodeurl, err := e.trust.GetNodeURL(ctx, req.NodeId)
|
||||
@ -112,7 +113,7 @@ func (e *Endpoint) InitiateGracefulExit(ctx context.Context, req *pb.InitiateGra
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
|
||||
return &pb.ExitProgress{
|
||||
return &internalpb.ExitProgress{
|
||||
DomainName: nodeurl.Address,
|
||||
NodeId: req.NodeId,
|
||||
PercentComplete: float32(0),
|
||||
@ -120,14 +121,14 @@ func (e *Endpoint) InitiateGracefulExit(ctx context.Context, req *pb.InitiateGra
|
||||
}
|
||||
|
||||
// GetExitProgress returns graceful exit progress on each satellite that a storagde node has started exiting.
|
||||
func (e *Endpoint) GetExitProgress(ctx context.Context, req *pb.GetExitProgressRequest) (*pb.GetExitProgressResponse, error) {
|
||||
func (e *Endpoint) GetExitProgress(ctx context.Context, req *internalpb.GetExitProgressRequest) (*internalpb.GetExitProgressResponse, error) {
|
||||
exitProgress, err := e.satellites.ListGracefulExits(ctx)
|
||||
if err != nil {
|
||||
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
|
||||
}
|
||||
|
||||
resp := &pb.GetExitProgressResponse{
|
||||
Progress: make([]*pb.ExitProgress, 0, len(exitProgress)),
|
||||
resp := &internalpb.GetExitProgressResponse{
|
||||
Progress: make([]*internalpb.ExitProgress, 0, len(exitProgress)),
|
||||
}
|
||||
for _, progress := range exitProgress {
|
||||
nodeurl, err := e.trust.GetNodeURL(ctx, progress.SatelliteID)
|
||||
@ -148,7 +149,7 @@ func (e *Endpoint) GetExitProgress(ctx context.Context, req *pb.GetExitProgressR
|
||||
}
|
||||
|
||||
resp.Progress = append(resp.Progress,
|
||||
&pb.ExitProgress{
|
||||
&internalpb.ExitProgress{
|
||||
DomainName: nodeurl.Address,
|
||||
NodeId: progress.SatelliteID,
|
||||
PercentComplete: percentCompleted,
|
||||
@ -161,7 +162,7 @@ func (e *Endpoint) GetExitProgress(ctx context.Context, req *pb.GetExitProgressR
|
||||
}
|
||||
|
||||
// GracefulExitFeasibility returns graceful exit feasibility by node's age on chosen satellite.
|
||||
func (e *Endpoint) GracefulExitFeasibility(ctx context.Context, request *pb.GracefulExitFeasibilityNodeRequest) (*pb.GracefulExitFeasibilityResponse, error) {
|
||||
func (e *Endpoint) GracefulExitFeasibility(ctx context.Context, request *internalpb.GracefulExitFeasibilityRequest) (*internalpb.GracefulExitFeasibilityResponse, error) {
|
||||
nodeurl, err := e.trust.GetNodeURL(ctx, request.NodeId)
|
||||
if err != nil {
|
||||
return nil, errs.New("unable to find satellite %s: %w", request.NodeId, err)
|
||||
@ -181,5 +182,7 @@ func (e *Endpoint) GracefulExitFeasibility(ctx context.Context, request *pb.Grac
|
||||
if err != nil {
|
||||
return nil, errs.Wrap(err)
|
||||
}
|
||||
return feasibility, nil
|
||||
|
||||
response := (internalpb.GracefulExitFeasibilityResponse)(*feasibility)
|
||||
return &response, nil
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"storj.io/common/pb"
|
||||
"storj.io/common/testcontext"
|
||||
"storj.io/storj/private/testplanet"
|
||||
"storj.io/storj/storagenode/internalpb"
|
||||
)
|
||||
|
||||
func TestGetNonExitingSatellites(t *testing.T) {
|
||||
@ -27,7 +27,7 @@ func TestGetNonExitingSatellites(t *testing.T) {
|
||||
err := storagenode.DB.Satellites().InitiateGracefulExit(ctx, exitingSatellite.ID(), time.Now(), 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
nonExitingSatellites, err := storagenode.GracefulExit.Endpoint.GetNonExitingSatellites(ctx, &pb.GetNonExitingSatellitesRequest{})
|
||||
nonExitingSatellites, err := storagenode.GracefulExit.Endpoint.GetNonExitingSatellites(ctx, &internalpb.GetNonExitingSatellitesRequest{})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, nonExitingSatellites.GetSatellites(), totalSatelliteCount-exitingSatelliteCount)
|
||||
|
||||
@ -44,7 +44,7 @@ func TestInitiateGracefulExit(t *testing.T) {
|
||||
storagenode := planet.StorageNodes[0]
|
||||
exitingSatelliteID := planet.Satellites[0].ID()
|
||||
|
||||
req := &pb.InitiateGracefulExitRequest{
|
||||
req := &internalpb.InitiateGracefulExitRequest{
|
||||
NodeId: exitingSatelliteID,
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ func TestGetExitProgress(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// check graceful exit progress
|
||||
resp, err := storagenode.GracefulExit.Endpoint.GetExitProgress(ctx, &pb.GetExitProgressRequest{})
|
||||
resp, err := storagenode.GracefulExit.Endpoint.GetExitProgress(ctx, &internalpb.GetExitProgressRequest{})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, resp.GetProgress(), 1)
|
||||
progress := resp.GetProgress()[0]
|
||||
|
635
storagenode/internalpb/gracefulexit.pb.go
Normal file
635
storagenode/internalpb/gracefulexit.pb.go
Normal file
@ -0,0 +1,635 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: gracefulexit.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 GetNonExitingSatellitesRequest struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetNonExitingSatellitesRequest) Reset() { *m = GetNonExitingSatellitesRequest{} }
|
||||
func (m *GetNonExitingSatellitesRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetNonExitingSatellitesRequest) ProtoMessage() {}
|
||||
func (*GetNonExitingSatellitesRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8f0acbf2ce5fa631, []int{0}
|
||||
}
|
||||
func (m *GetNonExitingSatellitesRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetNonExitingSatellitesRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetNonExitingSatellitesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetNonExitingSatellitesRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetNonExitingSatellitesRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetNonExitingSatellitesRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GetNonExitingSatellitesRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetNonExitingSatellitesRequest.Size(m)
|
||||
}
|
||||
func (m *GetNonExitingSatellitesRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetNonExitingSatellitesRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetNonExitingSatellitesRequest proto.InternalMessageInfo
|
||||
|
||||
type GetNonExitingSatellitesResponse struct {
|
||||
Satellites []*NonExitingSatellite `protobuf:"bytes,1,rep,name=satellites,proto3" json:"satellites,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetNonExitingSatellitesResponse) Reset() { *m = GetNonExitingSatellitesResponse{} }
|
||||
func (m *GetNonExitingSatellitesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetNonExitingSatellitesResponse) ProtoMessage() {}
|
||||
func (*GetNonExitingSatellitesResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8f0acbf2ce5fa631, []int{1}
|
||||
}
|
||||
func (m *GetNonExitingSatellitesResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetNonExitingSatellitesResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetNonExitingSatellitesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetNonExitingSatellitesResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetNonExitingSatellitesResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetNonExitingSatellitesResponse.Merge(m, src)
|
||||
}
|
||||
func (m *GetNonExitingSatellitesResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_GetNonExitingSatellitesResponse.Size(m)
|
||||
}
|
||||
func (m *GetNonExitingSatellitesResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetNonExitingSatellitesResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetNonExitingSatellitesResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *GetNonExitingSatellitesResponse) GetSatellites() []*NonExitingSatellite {
|
||||
if m != nil {
|
||||
return m.Satellites
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NonExitingSatellite contains information that's needed for a storagenode to start graceful exit.
|
||||
type NonExitingSatellite struct {
|
||||
NodeId NodeID `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"`
|
||||
DomainName string `protobuf:"bytes,2,opt,name=domain_name,json=domainName,proto3" json:"domain_name,omitempty"`
|
||||
SpaceUsed float64 `protobuf:"fixed64,3,opt,name=space_used,json=spaceUsed,proto3" json:"space_used,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *NonExitingSatellite) Reset() { *m = NonExitingSatellite{} }
|
||||
func (m *NonExitingSatellite) String() string { return proto.CompactTextString(m) }
|
||||
func (*NonExitingSatellite) ProtoMessage() {}
|
||||
func (*NonExitingSatellite) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8f0acbf2ce5fa631, []int{2}
|
||||
}
|
||||
func (m *NonExitingSatellite) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_NonExitingSatellite.Unmarshal(m, b)
|
||||
}
|
||||
func (m *NonExitingSatellite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_NonExitingSatellite.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *NonExitingSatellite) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_NonExitingSatellite.Merge(m, src)
|
||||
}
|
||||
func (m *NonExitingSatellite) XXX_Size() int {
|
||||
return xxx_messageInfo_NonExitingSatellite.Size(m)
|
||||
}
|
||||
func (m *NonExitingSatellite) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_NonExitingSatellite.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_NonExitingSatellite proto.InternalMessageInfo
|
||||
|
||||
func (m *NonExitingSatellite) GetDomainName() string {
|
||||
if m != nil {
|
||||
return m.DomainName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *NonExitingSatellite) GetSpaceUsed() float64 {
|
||||
if m != nil {
|
||||
return m.SpaceUsed
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type InitiateGracefulExitRequest struct {
|
||||
NodeId NodeID `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *InitiateGracefulExitRequest) Reset() { *m = InitiateGracefulExitRequest{} }
|
||||
func (m *InitiateGracefulExitRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*InitiateGracefulExitRequest) ProtoMessage() {}
|
||||
func (*InitiateGracefulExitRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8f0acbf2ce5fa631, []int{3}
|
||||
}
|
||||
func (m *InitiateGracefulExitRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_InitiateGracefulExitRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *InitiateGracefulExitRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_InitiateGracefulExitRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *InitiateGracefulExitRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_InitiateGracefulExitRequest.Merge(m, src)
|
||||
}
|
||||
func (m *InitiateGracefulExitRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_InitiateGracefulExitRequest.Size(m)
|
||||
}
|
||||
func (m *InitiateGracefulExitRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_InitiateGracefulExitRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_InitiateGracefulExitRequest proto.InternalMessageInfo
|
||||
|
||||
type GetExitProgressRequest struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetExitProgressRequest) Reset() { *m = GetExitProgressRequest{} }
|
||||
func (m *GetExitProgressRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetExitProgressRequest) ProtoMessage() {}
|
||||
func (*GetExitProgressRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8f0acbf2ce5fa631, []int{4}
|
||||
}
|
||||
func (m *GetExitProgressRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetExitProgressRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetExitProgressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetExitProgressRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetExitProgressRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetExitProgressRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GetExitProgressRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetExitProgressRequest.Size(m)
|
||||
}
|
||||
func (m *GetExitProgressRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetExitProgressRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetExitProgressRequest proto.InternalMessageInfo
|
||||
|
||||
type GetExitProgressResponse struct {
|
||||
Progress []*ExitProgress `protobuf:"bytes,1,rep,name=progress,proto3" json:"progress,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetExitProgressResponse) Reset() { *m = GetExitProgressResponse{} }
|
||||
func (m *GetExitProgressResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetExitProgressResponse) ProtoMessage() {}
|
||||
func (*GetExitProgressResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8f0acbf2ce5fa631, []int{5}
|
||||
}
|
||||
func (m *GetExitProgressResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetExitProgressResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetExitProgressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetExitProgressResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetExitProgressResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetExitProgressResponse.Merge(m, src)
|
||||
}
|
||||
func (m *GetExitProgressResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_GetExitProgressResponse.Size(m)
|
||||
}
|
||||
func (m *GetExitProgressResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetExitProgressResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetExitProgressResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *GetExitProgressResponse) GetProgress() []*ExitProgress {
|
||||
if m != nil {
|
||||
return m.Progress
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ExitProgress struct {
|
||||
DomainName string `protobuf:"bytes,1,opt,name=domain_name,json=domainName,proto3" json:"domain_name,omitempty"`
|
||||
NodeId NodeID `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"`
|
||||
PercentComplete float32 `protobuf:"fixed32,3,opt,name=percent_complete,json=percentComplete,proto3" json:"percent_complete,omitempty"`
|
||||
Successful bool `protobuf:"varint,4,opt,name=successful,proto3" json:"successful,omitempty"`
|
||||
CompletionReceipt []byte `protobuf:"bytes,5,opt,name=completion_receipt,json=completionReceipt,proto3" json:"completion_receipt,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ExitProgress) Reset() { *m = ExitProgress{} }
|
||||
func (m *ExitProgress) String() string { return proto.CompactTextString(m) }
|
||||
func (*ExitProgress) ProtoMessage() {}
|
||||
func (*ExitProgress) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8f0acbf2ce5fa631, []int{6}
|
||||
}
|
||||
func (m *ExitProgress) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ExitProgress.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ExitProgress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ExitProgress.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ExitProgress) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ExitProgress.Merge(m, src)
|
||||
}
|
||||
func (m *ExitProgress) XXX_Size() int {
|
||||
return xxx_messageInfo_ExitProgress.Size(m)
|
||||
}
|
||||
func (m *ExitProgress) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ExitProgress.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ExitProgress proto.InternalMessageInfo
|
||||
|
||||
func (m *ExitProgress) GetDomainName() string {
|
||||
if m != nil {
|
||||
return m.DomainName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ExitProgress) GetPercentComplete() float32 {
|
||||
if m != nil {
|
||||
return m.PercentComplete
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ExitProgress) GetSuccessful() bool {
|
||||
if m != nil {
|
||||
return m.Successful
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *ExitProgress) GetCompletionReceipt() []byte {
|
||||
if m != nil {
|
||||
return m.CompletionReceipt
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GracefulExitFeasibilityRequest struct {
|
||||
NodeId NodeID `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3,customtype=NodeID" json:"node_id"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GracefulExitFeasibilityRequest) Reset() { *m = GracefulExitFeasibilityRequest{} }
|
||||
func (m *GracefulExitFeasibilityRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GracefulExitFeasibilityRequest) ProtoMessage() {}
|
||||
func (*GracefulExitFeasibilityRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8f0acbf2ce5fa631, []int{7}
|
||||
}
|
||||
func (m *GracefulExitFeasibilityRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GracefulExitFeasibilityRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GracefulExitFeasibilityRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GracefulExitFeasibilityRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GracefulExitFeasibilityRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GracefulExitFeasibilityRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GracefulExitFeasibilityRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GracefulExitFeasibilityRequest.Size(m)
|
||||
}
|
||||
func (m *GracefulExitFeasibilityRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GracefulExitFeasibilityRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GracefulExitFeasibilityRequest proto.InternalMessageInfo
|
||||
|
||||
type GracefulExitFeasibilityResponse struct {
|
||||
JoinedAt time.Time `protobuf:"bytes,1,opt,name=joined_at,json=joinedAt,proto3,stdtime" json:"joined_at"`
|
||||
MonthsRequired int32 `protobuf:"varint,2,opt,name=months_required,json=monthsRequired,proto3" json:"months_required,omitempty"`
|
||||
IsAllowed bool `protobuf:"varint,3,opt,name=is_allowed,json=isAllowed,proto3" json:"is_allowed,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GracefulExitFeasibilityResponse) Reset() { *m = GracefulExitFeasibilityResponse{} }
|
||||
func (m *GracefulExitFeasibilityResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*GracefulExitFeasibilityResponse) ProtoMessage() {}
|
||||
func (*GracefulExitFeasibilityResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_8f0acbf2ce5fa631, []int{8}
|
||||
}
|
||||
func (m *GracefulExitFeasibilityResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GracefulExitFeasibilityResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GracefulExitFeasibilityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GracefulExitFeasibilityResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GracefulExitFeasibilityResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GracefulExitFeasibilityResponse.Merge(m, src)
|
||||
}
|
||||
func (m *GracefulExitFeasibilityResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_GracefulExitFeasibilityResponse.Size(m)
|
||||
}
|
||||
func (m *GracefulExitFeasibilityResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GracefulExitFeasibilityResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GracefulExitFeasibilityResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *GracefulExitFeasibilityResponse) GetJoinedAt() time.Time {
|
||||
if m != nil {
|
||||
return m.JoinedAt
|
||||
}
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
func (m *GracefulExitFeasibilityResponse) GetMonthsRequired() int32 {
|
||||
if m != nil {
|
||||
return m.MonthsRequired
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *GracefulExitFeasibilityResponse) GetIsAllowed() bool {
|
||||
if m != nil {
|
||||
return m.IsAllowed
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*GetNonExitingSatellitesRequest)(nil), "gracefulexit.GetNonExitingSatellitesRequest")
|
||||
proto.RegisterType((*GetNonExitingSatellitesResponse)(nil), "gracefulexit.GetNonExitingSatellitesResponse")
|
||||
proto.RegisterType((*NonExitingSatellite)(nil), "gracefulexit.NonExitingSatellite")
|
||||
proto.RegisterType((*InitiateGracefulExitRequest)(nil), "gracefulexit.InitiateGracefulExitRequest")
|
||||
proto.RegisterType((*GetExitProgressRequest)(nil), "gracefulexit.GetExitProgressRequest")
|
||||
proto.RegisterType((*GetExitProgressResponse)(nil), "gracefulexit.GetExitProgressResponse")
|
||||
proto.RegisterType((*ExitProgress)(nil), "gracefulexit.ExitProgress")
|
||||
proto.RegisterType((*GracefulExitFeasibilityRequest)(nil), "gracefulexit.GracefulExitFeasibilityRequest")
|
||||
proto.RegisterType((*GracefulExitFeasibilityResponse)(nil), "gracefulexit.GracefulExitFeasibilityResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("gracefulexit.proto", fileDescriptor_8f0acbf2ce5fa631) }
|
||||
|
||||
var fileDescriptor_8f0acbf2ce5fa631 = []byte{
|
||||
// 599 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4f, 0x4f, 0xd4, 0x40,
|
||||
0x1c, 0xb5, 0x20, 0xb8, 0xfb, 0x83, 0x00, 0x8e, 0x46, 0x9b, 0x35, 0xd2, 0xda, 0x48, 0x58, 0x12,
|
||||
0xd9, 0x4d, 0x30, 0xf1, 0x0e, 0x2a, 0x64, 0x2f, 0x44, 0x47, 0xbd, 0x98, 0x68, 0x33, 0xdb, 0xfe,
|
||||
0xa8, 0x43, 0xda, 0x99, 0xd2, 0x99, 0x2a, 0x5e, 0xfc, 0x0c, 0x7e, 0x10, 0xbf, 0x84, 0x37, 0xcf,
|
||||
0x1e, 0x3d, 0xe0, 0x57, 0x31, 0x6d, 0x87, 0xb5, 0xcb, 0x96, 0x8a, 0x97, 0xcd, 0xf6, 0xfd, 0xfe,
|
||||
0xcc, 0x9b, 0x37, 0xef, 0x01, 0x89, 0x32, 0x16, 0xe0, 0x51, 0x1e, 0xe3, 0x29, 0xd7, 0x83, 0x34,
|
||||
0x93, 0x5a, 0x92, 0xe5, 0x3a, 0xd6, 0x83, 0x48, 0x46, 0xb2, 0xaa, 0xf4, 0x9c, 0x48, 0xca, 0x28,
|
||||
0xc6, 0x61, 0xf9, 0x35, 0xce, 0x8f, 0x86, 0x9a, 0x27, 0xa8, 0x34, 0x4b, 0xd2, 0xaa, 0xc1, 0x73,
|
||||
0x61, 0xfd, 0x00, 0xf5, 0xa1, 0x14, 0xcf, 0x4f, 0xb9, 0xe6, 0x22, 0x7a, 0xc5, 0x34, 0xc6, 0x31,
|
||||
0xd7, 0xa8, 0x28, 0x9e, 0xe4, 0xa8, 0xb4, 0x17, 0x82, 0x73, 0x69, 0x87, 0x4a, 0xa5, 0x50, 0x48,
|
||||
0x76, 0x01, 0xd4, 0x04, 0xb5, 0x2d, 0x77, 0xbe, 0xbf, 0xb4, 0xf3, 0x60, 0x30, 0x45, 0xb4, 0x61,
|
||||
0x9e, 0xd6, 0x86, 0xbc, 0x2f, 0x70, 0xab, 0xa1, 0x85, 0x6c, 0xc2, 0x0d, 0x21, 0x43, 0xf4, 0x79,
|
||||
0x68, 0x5b, 0xae, 0xd5, 0x5f, 0xde, 0x5b, 0xf9, 0x71, 0xe6, 0x5c, 0xfb, 0x75, 0xe6, 0x2c, 0x1e,
|
||||
0xca, 0x10, 0x47, 0xcf, 0xe8, 0x62, 0x51, 0x1e, 0x85, 0xc4, 0x81, 0xa5, 0x50, 0x26, 0x8c, 0x0b,
|
||||
0x5f, 0xb0, 0x04, 0xed, 0x39, 0xd7, 0xea, 0x77, 0x29, 0x54, 0xd0, 0x21, 0x4b, 0x90, 0xdc, 0x07,
|
||||
0x50, 0x29, 0x0b, 0xd0, 0xcf, 0x15, 0x86, 0xf6, 0xbc, 0x6b, 0xf5, 0x2d, 0xda, 0x2d, 0x91, 0x37,
|
||||
0x0a, 0x43, 0x6f, 0x1f, 0xee, 0x8d, 0x04, 0xd7, 0x9c, 0x69, 0x3c, 0x30, 0xbc, 0x0b, 0x32, 0x46,
|
||||
0x84, 0x2b, 0xf3, 0xf0, 0x6c, 0xb8, 0x73, 0x80, 0xba, 0x18, 0x7d, 0x91, 0xc9, 0x28, 0x43, 0x35,
|
||||
0xd1, 0xf1, 0x25, 0xdc, 0x9d, 0xa9, 0x18, 0xfd, 0x9e, 0x40, 0x27, 0x35, 0x98, 0x51, 0xaf, 0x37,
|
||||
0xad, 0xde, 0xd4, 0xd4, 0xa4, 0xd7, 0xfb, 0x69, 0xc1, 0x72, 0xbd, 0x74, 0x51, 0x05, 0x6b, 0x46,
|
||||
0x85, 0xda, 0x3d, 0xe6, 0x5a, 0xf5, 0xdc, 0x82, 0xb5, 0x14, 0xb3, 0x00, 0x85, 0xf6, 0x03, 0x99,
|
||||
0xa4, 0x31, 0x6a, 0x2c, 0x45, 0x9b, 0xa3, 0xab, 0x06, 0x7f, 0x6a, 0x60, 0xb2, 0x0e, 0xa0, 0xf2,
|
||||
0x20, 0x40, 0xa5, 0x8e, 0xf2, 0xd8, 0xbe, 0xee, 0x5a, 0xfd, 0x0e, 0xad, 0x21, 0x64, 0x1b, 0x88,
|
||||
0x59, 0xc1, 0xa5, 0xf0, 0x33, 0x0c, 0x90, 0xa7, 0xda, 0x5e, 0x28, 0x8e, 0xa7, 0x37, 0xff, 0x56,
|
||||
0x68, 0x55, 0xf0, 0x46, 0xb0, 0x5e, 0x7f, 0x81, 0x7d, 0x64, 0x8a, 0x8f, 0x79, 0xcc, 0xf5, 0xe7,
|
||||
0xff, 0x7e, 0x8c, 0x6f, 0x16, 0x38, 0x97, 0xee, 0x9a, 0x78, 0xb7, 0x7b, 0x2c, 0xb9, 0xc0, 0xd0,
|
||||
0x67, 0xba, 0x5c, 0x57, 0x8a, 0x5f, 0xa6, 0x66, 0x70, 0x9e, 0x9a, 0xc1, 0xeb, 0xf3, 0xd4, 0xec,
|
||||
0x75, 0x8a, 0xa3, 0xbe, 0xfe, 0x76, 0x2c, 0xda, 0xa9, 0xc6, 0x76, 0x0b, 0x3e, 0xab, 0x89, 0x14,
|
||||
0xfa, 0x83, 0xf2, 0x33, 0x3c, 0xc9, 0x79, 0x86, 0x95, 0xb8, 0x0b, 0x74, 0xa5, 0x82, 0xa9, 0x41,
|
||||
0x0b, 0x0f, 0x72, 0xe5, 0xb3, 0x38, 0x96, 0x9f, 0x8c, 0x07, 0x3b, 0xb4, 0xcb, 0xd5, 0x6e, 0x05,
|
||||
0xec, 0x7c, 0x9f, 0x87, 0xb5, 0xe2, 0x06, 0x75, 0xca, 0xe4, 0x63, 0x69, 0x9b, 0xa6, 0xf8, 0x91,
|
||||
0x47, 0xd3, 0x26, 0x69, 0xcf, 0x71, 0x6f, 0xfb, 0x8a, 0xdd, 0x46, 0x97, 0x77, 0x70, 0xbb, 0x29,
|
||||
0x10, 0x64, 0x6b, 0x7a, 0x4d, 0x4b, 0x68, 0x7a, 0x2d, 0x26, 0x26, 0xef, 0x61, 0xf5, 0x42, 0x1a,
|
||||
0xc8, 0xc3, 0x19, 0x82, 0x0d, 0x31, 0xea, 0x6d, 0xfc, 0xa3, 0xcb, 0xd0, 0x2f, 0x64, 0x6b, 0x7e,
|
||||
0xf9, 0x19, 0xd9, 0x5a, 0xcd, 0x36, 0x23, 0x5b, 0xbb, 0x9d, 0xf6, 0x36, 0xdf, 0x6e, 0x28, 0x2d,
|
||||
0xb3, 0xe3, 0x01, 0x97, 0xc3, 0xf2, 0x4f, 0xf9, 0xcb, 0x22, 0x2c, 0x2c, 0x39, 0xe4, 0x42, 0x63,
|
||||
0x26, 0x58, 0x9c, 0x8e, 0xc7, 0x8b, 0xa5, 0xb9, 0x1e, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xfc,
|
||||
0xc2, 0x4a, 0x80, 0xd0, 0x05, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// --- DRPC BEGIN ---
|
||||
|
||||
type DRPCNodeGracefulExitClient interface {
|
||||
DRPCConn() drpc.Conn
|
||||
|
||||
// GetSatellitesList returns a list of satellites that the storagenode has not exited.
|
||||
GetNonExitingSatellites(ctx context.Context, in *GetNonExitingSatellitesRequest) (*GetNonExitingSatellitesResponse, error)
|
||||
// InitiateGracefulExit updates one or more satellites in the storagenode's database to be gracefully exiting.
|
||||
InitiateGracefulExit(ctx context.Context, in *InitiateGracefulExitRequest) (*ExitProgress, error)
|
||||
// GetExitProgress returns graceful exit status on each satellite for a given storagenode.
|
||||
GetExitProgress(ctx context.Context, in *GetExitProgressRequest) (*GetExitProgressResponse, error)
|
||||
// GracefulExitFeasibility returns node's join date and satellites config's amount of months required for graceful exit to be allowed.
|
||||
GracefulExitFeasibility(ctx context.Context, in *GracefulExitFeasibilityRequest) (*GracefulExitFeasibilityResponse, error)
|
||||
}
|
||||
|
||||
type drpcNodeGracefulExitClient struct {
|
||||
cc drpc.Conn
|
||||
}
|
||||
|
||||
func NewDRPCNodeGracefulExitClient(cc drpc.Conn) DRPCNodeGracefulExitClient {
|
||||
return &drpcNodeGracefulExitClient{cc}
|
||||
}
|
||||
|
||||
func (c *drpcNodeGracefulExitClient) DRPCConn() drpc.Conn { return c.cc }
|
||||
|
||||
func (c *drpcNodeGracefulExitClient) GetNonExitingSatellites(ctx context.Context, in *GetNonExitingSatellitesRequest) (*GetNonExitingSatellitesResponse, error) {
|
||||
out := new(GetNonExitingSatellitesResponse)
|
||||
err := c.cc.Invoke(ctx, "/gracefulexit.NodeGracefulExit/GetNonExitingSatellites", in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcNodeGracefulExitClient) InitiateGracefulExit(ctx context.Context, in *InitiateGracefulExitRequest) (*ExitProgress, error) {
|
||||
out := new(ExitProgress)
|
||||
err := c.cc.Invoke(ctx, "/gracefulexit.NodeGracefulExit/InitiateGracefulExit", in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcNodeGracefulExitClient) GetExitProgress(ctx context.Context, in *GetExitProgressRequest) (*GetExitProgressResponse, error) {
|
||||
out := new(GetExitProgressResponse)
|
||||
err := c.cc.Invoke(ctx, "/gracefulexit.NodeGracefulExit/GetExitProgress", in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcNodeGracefulExitClient) GracefulExitFeasibility(ctx context.Context, in *GracefulExitFeasibilityRequest) (*GracefulExitFeasibilityResponse, error) {
|
||||
out := new(GracefulExitFeasibilityResponse)
|
||||
err := c.cc.Invoke(ctx, "/gracefulexit.NodeGracefulExit/GracefulExitFeasibility", in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type DRPCNodeGracefulExitServer interface {
|
||||
// GetSatellitesList returns a list of satellites that the storagenode has not exited.
|
||||
GetNonExitingSatellites(context.Context, *GetNonExitingSatellitesRequest) (*GetNonExitingSatellitesResponse, error)
|
||||
// InitiateGracefulExit updates one or more satellites in the storagenode's database to be gracefully exiting.
|
||||
InitiateGracefulExit(context.Context, *InitiateGracefulExitRequest) (*ExitProgress, error)
|
||||
// GetExitProgress returns graceful exit status on each satellite for a given storagenode.
|
||||
GetExitProgress(context.Context, *GetExitProgressRequest) (*GetExitProgressResponse, error)
|
||||
// GracefulExitFeasibility returns node's join date and satellites config's amount of months required for graceful exit to be allowed.
|
||||
GracefulExitFeasibility(context.Context, *GracefulExitFeasibilityRequest) (*GracefulExitFeasibilityResponse, error)
|
||||
}
|
||||
|
||||
type DRPCNodeGracefulExitDescription struct{}
|
||||
|
||||
func (DRPCNodeGracefulExitDescription) NumMethods() int { return 4 }
|
||||
|
||||
func (DRPCNodeGracefulExitDescription) Method(n int) (string, drpc.Receiver, interface{}, bool) {
|
||||
switch n {
|
||||
case 0:
|
||||
return "/gracefulexit.NodeGracefulExit/GetNonExitingSatellites",
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCNodeGracefulExitServer).
|
||||
GetNonExitingSatellites(
|
||||
ctx,
|
||||
in1.(*GetNonExitingSatellitesRequest),
|
||||
)
|
||||
}, DRPCNodeGracefulExitServer.GetNonExitingSatellites, true
|
||||
case 1:
|
||||
return "/gracefulexit.NodeGracefulExit/InitiateGracefulExit",
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCNodeGracefulExitServer).
|
||||
InitiateGracefulExit(
|
||||
ctx,
|
||||
in1.(*InitiateGracefulExitRequest),
|
||||
)
|
||||
}, DRPCNodeGracefulExitServer.InitiateGracefulExit, true
|
||||
case 2:
|
||||
return "/gracefulexit.NodeGracefulExit/GetExitProgress",
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCNodeGracefulExitServer).
|
||||
GetExitProgress(
|
||||
ctx,
|
||||
in1.(*GetExitProgressRequest),
|
||||
)
|
||||
}, DRPCNodeGracefulExitServer.GetExitProgress, true
|
||||
case 3:
|
||||
return "/gracefulexit.NodeGracefulExit/GracefulExitFeasibility",
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCNodeGracefulExitServer).
|
||||
GracefulExitFeasibility(
|
||||
ctx,
|
||||
in1.(*GracefulExitFeasibilityRequest),
|
||||
)
|
||||
}, DRPCNodeGracefulExitServer.GracefulExitFeasibility, true
|
||||
default:
|
||||
return "", nil, nil, false
|
||||
}
|
||||
}
|
||||
|
||||
func DRPCRegisterNodeGracefulExit(mux drpc.Mux, impl DRPCNodeGracefulExitServer) error {
|
||||
return mux.Register(impl, DRPCNodeGracefulExitDescription{})
|
||||
}
|
||||
|
||||
type DRPCNodeGracefulExit_GetNonExitingSatellitesStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*GetNonExitingSatellitesResponse) error
|
||||
}
|
||||
|
||||
type drpcNodeGracefulExitGetNonExitingSatellitesStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcNodeGracefulExitGetNonExitingSatellitesStream) SendAndClose(m *GetNonExitingSatellitesResponse) error {
|
||||
if err := x.MsgSend(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCNodeGracefulExit_InitiateGracefulExitStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*ExitProgress) error
|
||||
}
|
||||
|
||||
type drpcNodeGracefulExitInitiateGracefulExitStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcNodeGracefulExitInitiateGracefulExitStream) SendAndClose(m *ExitProgress) error {
|
||||
if err := x.MsgSend(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCNodeGracefulExit_GetExitProgressStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*GetExitProgressResponse) error
|
||||
}
|
||||
|
||||
type drpcNodeGracefulExitGetExitProgressStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcNodeGracefulExitGetExitProgressStream) SendAndClose(m *GetExitProgressResponse) error {
|
||||
if err := x.MsgSend(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCNodeGracefulExit_GracefulExitFeasibilityStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*GracefulExitFeasibilityResponse) error
|
||||
}
|
||||
|
||||
type drpcNodeGracefulExitGracefulExitFeasibilityStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcNodeGracefulExitGracefulExitFeasibilityStream) SendAndClose(m *GracefulExitFeasibilityResponse) error {
|
||||
if err := x.MsgSend(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
// --- DRPC END ---
|
63
storagenode/internalpb/gracefulexit.proto
Normal file
63
storagenode/internalpb/gracefulexit.proto
Normal file
@ -0,0 +1,63 @@
|
||||
// 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 gracefulexit;
|
||||
|
||||
// NodeGracefulExit is a private service on storagenodes.
|
||||
service NodeGracefulExit {
|
||||
// GetSatellitesList returns a list of satellites that the storagenode has not exited.
|
||||
rpc GetNonExitingSatellites(GetNonExitingSatellitesRequest) returns (GetNonExitingSatellitesResponse);
|
||||
// InitiateGracefulExit updates one or more satellites in the storagenode's database to be gracefully exiting.
|
||||
rpc InitiateGracefulExit(InitiateGracefulExitRequest) returns (ExitProgress);
|
||||
// GetExitProgress returns graceful exit status on each satellite for a given storagenode.
|
||||
rpc GetExitProgress(GetExitProgressRequest) returns (GetExitProgressResponse);
|
||||
// GracefulExitFeasibility returns node's join date and satellites config's amount of months required for graceful exit to be allowed.
|
||||
rpc GracefulExitFeasibility(GracefulExitFeasibilityRequest) returns (GracefulExitFeasibilityResponse);
|
||||
}
|
||||
|
||||
message GetNonExitingSatellitesRequest{}
|
||||
|
||||
message GetNonExitingSatellitesResponse {
|
||||
repeated NonExitingSatellite satellites = 1;
|
||||
}
|
||||
|
||||
// NonExitingSatellite contains information that's needed for a storagenode to start graceful exit.
|
||||
message NonExitingSatellite {
|
||||
bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
||||
string domain_name = 2;
|
||||
double space_used = 3;
|
||||
}
|
||||
|
||||
message InitiateGracefulExitRequest {
|
||||
bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message GetExitProgressRequest {}
|
||||
|
||||
message GetExitProgressResponse {
|
||||
repeated ExitProgress progress = 1;
|
||||
}
|
||||
|
||||
message ExitProgress {
|
||||
string domain_name = 1;
|
||||
bytes node_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
||||
float percent_complete = 3;
|
||||
bool successful = 4;
|
||||
bytes completion_receipt = 5;
|
||||
}
|
||||
|
||||
message GracefulExitFeasibilityRequest {
|
||||
bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message GracefulExitFeasibilityResponse {
|
||||
google.protobuf.Timestamp joined_at = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
||||
int32 months_required = 2;
|
||||
bool is_allowed = 3;
|
||||
}
|
@ -716,7 +716,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten
|
||||
peer.Dialer,
|
||||
peer.Storage2.BlobsCache,
|
||||
)
|
||||
if err := pb.DRPCRegisterNodeGracefulExit(peer.Server.PrivateDRPC(), peer.GracefulExit.Endpoint); err != nil {
|
||||
if err := internalpb.DRPCRegisterNodeGracefulExit(peer.Server.PrivateDRPC(), peer.GracefulExit.Endpoint); err != nil {
|
||||
return nil, errs.Combine(err, peer.Close())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user