From e4d6ce8dc5664fe3ad3c4d1c4ab9243e2ca3e09d Mon Sep 17 00:00:00 2001 From: Clement Sam Date: Fri, 12 Jan 2024 04:18:50 +0000 Subject: [PATCH] cmd/storagenode: add forget-satellite-status command Updates https://github.com/storj/storj/issues/6541 Change-Id: I159d323b090de6ad39eb4da6d3ca105234541284 --- cmd/storagenode/cmd_forget_satellite.go | 124 +++++++++++++++-- cmd/storagenode/cmd_forget_satellite_test.go | 2 +- cmd/storagenode/root.go | 1 + storagenode/forgetsatellite/endpoint.go | 33 +++++ storagenode/internalpb/forgetsatellite.pb.go | 126 ++++++++++++++---- storagenode/internalpb/forgetsatellite.proto | 9 ++ .../internalpb/forgetsatellite_drpc.pb.go | 42 +++++- 7 files changed, 298 insertions(+), 39 deletions(-) diff --git a/cmd/storagenode/cmd_forget_satellite.go b/cmd/storagenode/cmd_forget_satellite.go index 6a3dc2f20daf..7a0416704469 100644 --- a/cmd/storagenode/cmd_forget_satellite.go +++ b/cmd/storagenode/cmd_forget_satellite.go @@ -28,11 +28,11 @@ type forgetSatelliteCfg struct { Identity identity.Config Server server.Config - InitFSOptions + ForgetSatelliteOptions } -// InitFSOptions defines options for forget-satellite command. -type InitFSOptions struct { +// ForgetSatelliteOptions defines options for forget-satellite command. +type ForgetSatelliteOptions struct { SatelliteIDs []string `internal:"true"` AllUntrusted bool `help:"Clean up all untrusted satellites" default:"false"` @@ -41,6 +41,14 @@ type InitFSOptions struct { Stdout io.Writer `internal:"true"` } +type forgetSatelliteStatusCfg struct { + Identity identity.Config + Server server.Config + + SatelliteIDs []string `internal:"true"` + Stdout io.Writer `internal:"true"` +} + func newForgetSatelliteCmd(f *Factory) *cobra.Command { var cfg forgetSatelliteCfg cmd := &cobra.Command{ @@ -87,6 +95,36 @@ $ storagenode forget-satellite satellite_ID1 satellite_ID2 --force --identity-di return cmd } +func newForgetSatelliteStatusCmd(f *Factory) *cobra.Command { + var cfg forgetSatelliteStatusCfg + cmd := &cobra.Command{ + Use: "forget-satellite-status [satellite_IDs...]", + Short: "Get forget satellite status", + Long: "The command returns the status of the forget-satellite process for a satellite.\n", + Example: ` +# Get status for all processes +$ storagenode forget-satellite-status --identity-dir /path/to/identityDir --config-dir /path/to/configDir + +# Specify satellite ID to get status +$ storagenode forget-satellite-status --identity-dir /path/to/identityDir --config-dir /path/to/configDir satellite_ID + +# Specify multiple satellite IDs to get status +$ storagenode forget-satellite-status satellite_ID1 satellite_ID2 --identity-dir /path/to/identityDir --config-dir /path/to/configDir +`, + RunE: func(cmd *cobra.Command, args []string) error { + cfg.SatelliteIDs = args + + ctx, _ := process.Ctx(cmd) + return cmdForgetSatelliteStatus(ctx, zap.L(), &cfg) + }, + Annotations: map[string]string{"type": "helper"}, + } + + process.Bind(cmd, &cfg, f.Defaults, cfgstruct.ConfDir(f.ConfDir), cfgstruct.IdentityDir(f.IdentityDir)) + + return cmd +} + func cmdForgetSatellite(ctx context.Context, log *zap.Logger, cfg *forgetSatelliteCfg) (err error) { if cfg.Stdout == nil { cfg.Stdout = os.Stdout @@ -111,11 +149,11 @@ func cmdForgetSatellite(ctx context.Context, log *zap.Logger, cfg *forgetSatelli } }() - return initForgetSatellite(ctx, log, client, cfg.InitFSOptions) + return startForgetSatellite(ctx, log, client, cfg.ForgetSatelliteOptions) } -func initForgetSatellite(ctx context.Context, log *zap.Logger, client *forgetSatelliteClient, cfg InitFSOptions) (err error) { - if cfg.AllUntrusted { +func startForgetSatellite(ctx context.Context, log *zap.Logger, client *forgetSatelliteClient, opts ForgetSatelliteOptions) (err error) { + if opts.AllUntrusted { resp, err := client.getUntrustedSatellites(ctx) if err != nil { return errs.Wrap(err) @@ -127,18 +165,18 @@ func initForgetSatellite(ctx context.Context, log *zap.Logger, client *forgetSat } for _, satelliteID := range resp.SatelliteIds { - cfg.SatelliteIDs = append(cfg.SatelliteIDs, satelliteID.String()) + opts.SatelliteIDs = append(opts.SatelliteIDs, satelliteID.String()) } } - statuses := make([]*forgetSatelliteStatus, 0, len(cfg.SatelliteIDs)) - for _, satelliteID := range cfg.SatelliteIDs { + statuses := make([]*forgetSatelliteStatus, 0, len(opts.SatelliteIDs)) + for _, satelliteID := range opts.SatelliteIDs { id, err := storj.NodeIDFromString(satelliteID) if err != nil { return errs.Wrap(err) } - resp, err := client.initForgetSatellite(ctx, id, cfg.Force) + resp, err := client.startForgetSatellite(ctx, id, opts.Force) if err != nil { inProgress := false switch rpcstatus.Code(err) { @@ -159,6 +197,62 @@ func initForgetSatellite(ctx context.Context, log *zap.Logger, client *forgetSat statuses = append(statuses, &forgetSatelliteStatus{satelliteID: id, inProgress: resp.InProgress, successful: false}) } + w := tabwriter.NewWriter(opts.Stdout, 0, 0, 2, ' ', 0) + return displayStatus(w, statuses) +} + +func cmdForgetSatelliteStatus(ctx context.Context, log *zap.Logger, cfg *forgetSatelliteStatusCfg) (err error) { + if cfg.Stdout == nil { + cfg.Stdout = os.Stdout + } + // we don't really need the identity, but we load it as a sanity check + ident, err := cfg.Identity.Load() + if err != nil { + log.Fatal("Failed to load identity.", zap.Error(err)) + } else { + log.Info("Identity loaded.", zap.Stringer("Node ID", ident.ID)) + } + + client, err := dialForgetSatelliteClient(ctx, cfg.Server.PrivateAddress) + if err != nil { + return errs.Wrap(err) + } + + defer func() { + err = errs.Combine(err, client.close()) + if err != nil { + log.Debug("error closing forget-satellite client", zap.Error(err)) + } + }() + + statuses := make([]*forgetSatelliteStatus, 0, len(cfg.SatelliteIDs)) + for _, satelliteID := range cfg.SatelliteIDs { + id, err := storj.NodeIDFromString(satelliteID) + if err != nil { + return errs.Wrap(err) + } + + resp, err := client.getForgetSatelliteStatus(ctx, id) + if err != nil { + log.Error("Failed to get forget satellite status", zap.Stringer("Satellite ID", id), zap.Error(err)) + statuses = append(statuses, &forgetSatelliteStatus{satelliteID: id, inProgress: false, successful: false}) + continue + } + + statuses = append(statuses, &forgetSatelliteStatus{satelliteID: id, inProgress: resp.InProgress, successful: resp.Successful}) + } + + if len(cfg.SatelliteIDs) == 0 { + resp, err := client.getAllForgetSatelliteStatus(ctx) + if err != nil { + return errs.Wrap(err) + } + + for _, status := range resp.Statuses { + statuses = append(statuses, &forgetSatelliteStatus{satelliteID: status.SatelliteId, inProgress: status.InProgress, successful: status.Successful}) + } + } + w := tabwriter.NewWriter(cfg.Stdout, 0, 0, 2, ' ', 0) return displayStatus(w, statuses) } @@ -221,10 +315,18 @@ func (client *forgetSatelliteClient) getUntrustedSatellites(ctx context.Context) } -func (client *forgetSatelliteClient) initForgetSatellite(ctx context.Context, id storj.NodeID, force bool) (*internalpb.InitForgetSatelliteResponse, error) { +func (client *forgetSatelliteClient) startForgetSatellite(ctx context.Context, id storj.NodeID, force bool) (*internalpb.InitForgetSatelliteResponse, error) { return internalpb.NewDRPCNodeForgetSatelliteClient(client.conn).InitForgetSatellite(ctx, &internalpb.InitForgetSatelliteRequest{SatelliteId: id, ForceCleanup: force}) } +func (client *forgetSatelliteClient) getForgetSatelliteStatus(ctx context.Context, id storj.NodeID) (*internalpb.ForgetSatelliteStatusResponse, error) { + return internalpb.NewDRPCNodeForgetSatelliteClient(client.conn).ForgetSatelliteStatus(ctx, &internalpb.ForgetSatelliteStatusRequest{SatelliteId: id}) +} + +func (client *forgetSatelliteClient) getAllForgetSatelliteStatus(ctx context.Context) (*internalpb.GetAllForgetSatelliteStatusResponse, error) { + return internalpb.NewDRPCNodeForgetSatelliteClient(client.conn).GetAllForgetSatelliteStatus(ctx, &internalpb.GetAllForgetSatelliteStatusRequest{}) +} + func (client *forgetSatelliteClient) close() error { return client.conn.Close() } diff --git a/cmd/storagenode/cmd_forget_satellite_test.go b/cmd/storagenode/cmd_forget_satellite_test.go index 49113dc845d9..6e834e57a5af 100644 --- a/cmd/storagenode/cmd_forget_satellite_test.go +++ b/cmd/storagenode/cmd_forget_satellite_test.go @@ -132,7 +132,7 @@ func Test_cmdForgetSatellite(t *testing.T) { cmdCtx, cmdCancel := context.WithCancel(ctx) defer cmdCancel() - err = initForgetSatellite(cmdCtx, log, client, InitFSOptions{ + err = startForgetSatellite(cmdCtx, log, client, ForgetSatelliteOptions{ AllUntrusted: true, Stdout: &stdout, }) diff --git a/cmd/storagenode/root.go b/cmd/storagenode/root.go index 9ddeec78ce2b..6b05ea95afe5 100644 --- a/cmd/storagenode/root.go +++ b/cmd/storagenode/root.go @@ -60,6 +60,7 @@ func newRootCmd(setDefaults bool) (*cobra.Command, *Factory) { newGracefulExitInitCmd(factory), newGracefulExitStatusCmd(factory), newForgetSatelliteCmd(factory), + newForgetSatelliteStatusCmd(factory), // internal hidden commands internalcmd.NewUsedSpaceFilewalkerCmd().Command, internalcmd.NewGCFilewalkerCmd().Command, diff --git a/storagenode/forgetsatellite/endpoint.go b/storagenode/forgetsatellite/endpoint.go index 5db45a5cb9ac..91b230a1f41f 100644 --- a/storagenode/forgetsatellite/endpoint.go +++ b/storagenode/forgetsatellite/endpoint.go @@ -134,3 +134,36 @@ func (e *Endpoint) GetUntrustedSatellites(ctx context.Context, req *internalpb.G SatelliteIds: untrustedSatellites, }, nil } + +// GetAllForgetSatelliteStatus returns the status of the forget-satellite process for all satellites. +func (e *Endpoint) GetAllForgetSatelliteStatus(ctx context.Context, _ *internalpb.GetAllForgetSatelliteStatusRequest) (_ *internalpb.GetAllForgetSatelliteStatusResponse, err error) { + defer mon.Task()(&ctx)(&err) + + logger := e.log.With(zap.String("action", "GetAllForgetSatelliteStatus")) + + sats, err := e.satellites.GetSatellites(ctx) + if err != nil { + logger.Error("failed to get satellites", zap.Error(err)) + return nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) + } + + var statuses []*internalpb.ForgetSatelliteStatusResponse + for _, satellite := range sats { + if !isCleanupSatellite(&satellite) { + continue + } + statuses = append(statuses, &internalpb.ForgetSatelliteStatusResponse{ + SatelliteId: satellite.SatelliteID, + InProgress: satellite.Status == satellites.CleanupInProgress, + Successful: satellite.Status == satellites.CleanupSucceeded, + }) + } + + return &internalpb.GetAllForgetSatelliteStatusResponse{ + Statuses: statuses, + }, nil +} + +func isCleanupSatellite(satellite *satellites.Satellite) bool { + return satellite.Status == satellites.CleanupInProgress || satellite.Status == satellites.CleanupSucceeded || satellite.Status == satellites.CleanupFailed +} diff --git a/storagenode/internalpb/forgetsatellite.pb.go b/storagenode/internalpb/forgetsatellite.pb.go index 1b5e6f5f583e..596abdce39b4 100644 --- a/storagenode/internalpb/forgetsatellite.pb.go +++ b/storagenode/internalpb/forgetsatellite.pb.go @@ -243,6 +243,75 @@ func (m *ForgetSatelliteStatusResponse) GetSuccessful() bool { return false } +type GetAllForgetSatelliteStatusRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetAllForgetSatelliteStatusRequest) Reset() { *m = GetAllForgetSatelliteStatusRequest{} } +func (m *GetAllForgetSatelliteStatusRequest) String() string { return proto.CompactTextString(m) } +func (*GetAllForgetSatelliteStatusRequest) ProtoMessage() {} +func (*GetAllForgetSatelliteStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5ee03a9da2a32ad8, []int{6} +} +func (m *GetAllForgetSatelliteStatusRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetAllForgetSatelliteStatusRequest.Unmarshal(m, b) +} +func (m *GetAllForgetSatelliteStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetAllForgetSatelliteStatusRequest.Marshal(b, m, deterministic) +} +func (m *GetAllForgetSatelliteStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllForgetSatelliteStatusRequest.Merge(m, src) +} +func (m *GetAllForgetSatelliteStatusRequest) XXX_Size() int { + return xxx_messageInfo_GetAllForgetSatelliteStatusRequest.Size(m) +} +func (m *GetAllForgetSatelliteStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllForgetSatelliteStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAllForgetSatelliteStatusRequest proto.InternalMessageInfo + +type GetAllForgetSatelliteStatusResponse struct { + // statuses is the list of forget satellite statuses. + Statuses []*ForgetSatelliteStatusResponse `protobuf:"bytes,1,rep,name=statuses,proto3" json:"statuses,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetAllForgetSatelliteStatusResponse) Reset() { *m = GetAllForgetSatelliteStatusResponse{} } +func (m *GetAllForgetSatelliteStatusResponse) String() string { return proto.CompactTextString(m) } +func (*GetAllForgetSatelliteStatusResponse) ProtoMessage() {} +func (*GetAllForgetSatelliteStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5ee03a9da2a32ad8, []int{7} +} +func (m *GetAllForgetSatelliteStatusResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetAllForgetSatelliteStatusResponse.Unmarshal(m, b) +} +func (m *GetAllForgetSatelliteStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetAllForgetSatelliteStatusResponse.Marshal(b, m, deterministic) +} +func (m *GetAllForgetSatelliteStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllForgetSatelliteStatusResponse.Merge(m, src) +} +func (m *GetAllForgetSatelliteStatusResponse) XXX_Size() int { + return xxx_messageInfo_GetAllForgetSatelliteStatusResponse.Size(m) +} +func (m *GetAllForgetSatelliteStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllForgetSatelliteStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAllForgetSatelliteStatusResponse proto.InternalMessageInfo + +func (m *GetAllForgetSatelliteStatusResponse) GetStatuses() []*ForgetSatelliteStatusResponse { + if m != nil { + return m.Statuses + } + return nil +} + func init() { proto.RegisterType((*InitForgetSatelliteRequest)(nil), "storagenode.forgetsatellite.InitForgetSatelliteRequest") proto.RegisterType((*InitForgetSatelliteResponse)(nil), "storagenode.forgetsatellite.InitForgetSatelliteResponse") @@ -250,35 +319,40 @@ func init() { proto.RegisterType((*GetUntrustedSatellitesResponse)(nil), "storagenode.forgetsatellite.GetUntrustedSatellitesResponse") proto.RegisterType((*ForgetSatelliteStatusRequest)(nil), "storagenode.forgetsatellite.ForgetSatelliteStatusRequest") proto.RegisterType((*ForgetSatelliteStatusResponse)(nil), "storagenode.forgetsatellite.ForgetSatelliteStatusResponse") + proto.RegisterType((*GetAllForgetSatelliteStatusRequest)(nil), "storagenode.forgetsatellite.GetAllForgetSatelliteStatusRequest") + proto.RegisterType((*GetAllForgetSatelliteStatusResponse)(nil), "storagenode.forgetsatellite.GetAllForgetSatelliteStatusResponse") } func init() { proto.RegisterFile("forgetsatellite.proto", fileDescriptor_5ee03a9da2a32ad8) } var fileDescriptor_5ee03a9da2a32ad8 = []byte{ - // 388 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xc1, 0x6a, 0xe2, 0x50, - 0x14, 0x9d, 0x37, 0x82, 0xcc, 0x5c, 0x75, 0x16, 0x4f, 0x1c, 0x42, 0x1c, 0x8d, 0x64, 0x18, 0xc6, - 0x55, 0xa4, 0x75, 0xd1, 0xd6, 0xee, 0x6c, 0x69, 0x71, 0x53, 0x5a, 0xc5, 0x4d, 0x37, 0x12, 0x93, - 0x6b, 0x48, 0x09, 0xef, 0xc5, 0xf7, 0x5e, 0xfe, 0xa1, 0xab, 0x42, 0xe9, 0x37, 0x15, 0xfa, 0x0d, - 0x5d, 0xf8, 0x2d, 0xc5, 0x24, 0xb5, 0x22, 0x31, 0xd0, 0x40, 0x77, 0xe1, 0xe6, 0x9c, 0x73, 0xcf, - 0xbd, 0xf7, 0xf0, 0xa0, 0xb1, 0xe0, 0xc2, 0x43, 0x25, 0x6d, 0x85, 0x41, 0xe0, 0x2b, 0xb4, 0x42, - 0xc1, 0x15, 0xa7, 0x4d, 0xa9, 0xb8, 0xb0, 0x3d, 0x64, 0xdc, 0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0xd4, 0xd7, 0xc2, 0x3b, 0xce, 0xe8, 0x3d, 0x81, 0x7a, 0xc6, 0xb1, 0xe9, 0x91, 0x95, 0x93, 0x51, - 0x6b, 0x7f, 0x28, 0xf5, 0xe3, 0xcf, 0x13, 0xd3, 0xb5, 0x3c, 0x12, 0xf8, 0x9d, 0x7d, 0x63, 0x3a, - 0xc8, 0x15, 0xcd, 0x4d, 0x8e, 0x7e, 0x5a, 0x88, 0x9b, 0x7a, 0x7a, 0x20, 0xd0, 0xc8, 0x3c, 0x26, - 0x3d, 0xc9, 0x95, 0xcd, 0x0b, 0x95, 0x3e, 0x28, 0x42, 0x4d, 0x0c, 0x0d, 0xff, 0xdf, 0xfe, 0x5b, - 0x93, 0xef, 0x2c, 0x9f, 0xf7, 0xe2, 0x8f, 0xde, 0x96, 0x56, 0xcf, 0x67, 0x0a, 0x05, 0xb3, 0x83, - 0x70, 0x3e, 0x2f, 0xc7, 0x2f, 0x48, 0xff, 0x2d, 0x00, 0x00, 0xff, 0xff, 0xea, 0x72, 0x60, 0x50, - 0x83, 0x04, 0x00, 0x00, + // 444 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x14, 0x64, 0x29, 0xaa, 0xca, 0x4b, 0xca, 0x61, 0xab, 0x22, 0xcb, 0xa1, 0x75, 0xb4, 0x05, 0xd1, + 0x93, 0x23, 0xda, 0x03, 0x5f, 0x07, 0xa0, 0x20, 0xaa, 0x5c, 0x10, 0xb8, 0x2a, 0x07, 0x2e, 0x91, + 0x6b, 0xbf, 0x58, 0x46, 0xd6, 0xae, 0xbb, 0x6f, 0x7d, 0xe4, 0xce, 0x09, 0x09, 0xf1, 0x07, 0xf8, + 0x39, 0xfc, 0x06, 0x0e, 0x39, 0xf3, 0x33, 0x50, 0x6c, 0x63, 0xa2, 0xc8, 0xd9, 0x08, 0xa3, 0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, } diff --git a/storagenode/internalpb/forgetsatellite.proto b/storagenode/internalpb/forgetsatellite.proto index c8f23644e282..9d9ca5cebcfe 100644 --- a/storagenode/internalpb/forgetsatellite.proto +++ b/storagenode/internalpb/forgetsatellite.proto @@ -16,6 +16,8 @@ service NodeForgetSatellite { rpc GetUntrustedSatellites(GetUntrustedSatellitesRequest) returns (GetUntrustedSatellitesResponse); // ForgetSatelliteStatus returns the status of the forget satellite operation. rpc ForgetSatelliteStatus(ForgetSatelliteStatusRequest) returns (ForgetSatelliteStatusResponse); + // GetAllForgetSatelliteStatus returns the status of all forget satellite operations. + rpc GetAllForgetSatelliteStatus(GetAllForgetSatelliteStatusRequest) returns (GetAllForgetSatelliteStatusResponse); } message InitForgetSatelliteRequest { @@ -47,4 +49,11 @@ message ForgetSatelliteStatusResponse { // in_progress is true if the forget satellite operation is in progress. bool in_progress = 2; bool successful = 3; +} + +message GetAllForgetSatelliteStatusRequest {} + +message GetAllForgetSatelliteStatusResponse { + // statuses is the list of forget satellite statuses. + repeated ForgetSatelliteStatusResponse statuses = 1; } \ No newline at end of file diff --git a/storagenode/internalpb/forgetsatellite_drpc.pb.go b/storagenode/internalpb/forgetsatellite_drpc.pb.go index 5ca76590b910..557feadc7b56 100644 --- a/storagenode/internalpb/forgetsatellite_drpc.pb.go +++ b/storagenode/internalpb/forgetsatellite_drpc.pb.go @@ -45,6 +45,7 @@ type DRPCNodeForgetSatelliteClient interface { InitForgetSatellite(ctx context.Context, in *InitForgetSatelliteRequest) (*InitForgetSatelliteResponse, error) GetUntrustedSatellites(ctx context.Context, in *GetUntrustedSatellitesRequest) (*GetUntrustedSatellitesResponse, error) ForgetSatelliteStatus(ctx context.Context, in *ForgetSatelliteStatusRequest) (*ForgetSatelliteStatusResponse, error) + GetAllForgetSatelliteStatus(ctx context.Context, in *GetAllForgetSatelliteStatusRequest) (*GetAllForgetSatelliteStatusResponse, error) } type drpcNodeForgetSatelliteClient struct { @@ -84,10 +85,20 @@ func (c *drpcNodeForgetSatelliteClient) ForgetSatelliteStatus(ctx context.Contex return out, nil } +func (c *drpcNodeForgetSatelliteClient) GetAllForgetSatelliteStatus(ctx context.Context, in *GetAllForgetSatelliteStatusRequest) (*GetAllForgetSatelliteStatusResponse, error) { + out := new(GetAllForgetSatelliteStatusResponse) + err := c.cc.Invoke(ctx, "/storagenode.forgetsatellite.NodeForgetSatellite/GetAllForgetSatelliteStatus", drpcEncoding_File_forgetsatellite_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + type DRPCNodeForgetSatelliteServer interface { InitForgetSatellite(context.Context, *InitForgetSatelliteRequest) (*InitForgetSatelliteResponse, error) GetUntrustedSatellites(context.Context, *GetUntrustedSatellitesRequest) (*GetUntrustedSatellitesResponse, error) ForgetSatelliteStatus(context.Context, *ForgetSatelliteStatusRequest) (*ForgetSatelliteStatusResponse, error) + GetAllForgetSatelliteStatus(context.Context, *GetAllForgetSatelliteStatusRequest) (*GetAllForgetSatelliteStatusResponse, error) } type DRPCNodeForgetSatelliteUnimplementedServer struct{} @@ -104,9 +115,13 @@ func (s *DRPCNodeForgetSatelliteUnimplementedServer) ForgetSatelliteStatus(conte return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCNodeForgetSatelliteUnimplementedServer) GetAllForgetSatelliteStatus(context.Context, *GetAllForgetSatelliteStatusRequest) (*GetAllForgetSatelliteStatusResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + type DRPCNodeForgetSatelliteDescription struct{} -func (DRPCNodeForgetSatelliteDescription) NumMethods() int { return 3 } +func (DRPCNodeForgetSatelliteDescription) NumMethods() int { return 4 } func (DRPCNodeForgetSatelliteDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { @@ -137,6 +152,15 @@ func (DRPCNodeForgetSatelliteDescription) Method(n int) (string, drpc.Encoding, in1.(*ForgetSatelliteStatusRequest), ) }, DRPCNodeForgetSatelliteServer.ForgetSatelliteStatus, true + case 3: + return "/storagenode.forgetsatellite.NodeForgetSatellite/GetAllForgetSatelliteStatus", drpcEncoding_File_forgetsatellite_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCNodeForgetSatelliteServer). + GetAllForgetSatelliteStatus( + ctx, + in1.(*GetAllForgetSatelliteStatusRequest), + ) + }, DRPCNodeForgetSatelliteServer.GetAllForgetSatelliteStatus, true default: return "", nil, nil, nil, false } @@ -193,3 +217,19 @@ func (x *drpcNodeForgetSatellite_ForgetSatelliteStatusStream) SendAndClose(m *Fo } return x.CloseSend() } + +type DRPCNodeForgetSatellite_GetAllForgetSatelliteStatusStream interface { + drpc.Stream + SendAndClose(*GetAllForgetSatelliteStatusResponse) error +} + +type drpcNodeForgetSatellite_GetAllForgetSatelliteStatusStream struct { + drpc.Stream +} + +func (x *drpcNodeForgetSatellite_GetAllForgetSatelliteStatusStream) SendAndClose(m *GetAllForgetSatelliteStatusResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_forgetsatellite_proto{}); err != nil { + return err + } + return x.CloseSend() +}