Documentation
¶
Overview ¶
Package service provides the core business logic for nstance-admin operations. Both CLI commands and HTTP handlers use these services.
Index ¶
- type ConfigRefreshRequest
- type ConfigRefreshResponse
- type ConfigService
- type ConfigStatusRequest
- type ConfigStatusResponse
- type Connection
- type Connector
- func (c *Connector) Close()
- func (c *Connector) ConnectAll(ctx context.Context) ([]*Connection, error)
- func (c *Connector) ConnectShard(ctx context.Context, shardID string) (*Connection, error)
- func (c *Connector) GetConnection(ctx context.Context) (*grpc.ClientConn, string, error)
- func (c *Connector) Servers() []ShardServer
- type GroupCreateRequest
- type GroupCreateResponse
- type GroupCreateResult
- type GroupDeleteRequest
- type GroupDeleteResponse
- type GroupDeleteResult
- type GroupListRequest
- type GroupListResponse
- type GroupListResult
- type GroupScaleRequest
- type GroupScaleResponse
- type GroupScaleResult
- type GroupService
- func (s *GroupService) Create(ctx context.Context, req GroupCreateRequest) (*GroupCreateResponse, error)
- func (s *GroupService) Delete(ctx context.Context, req GroupDeleteRequest) (*GroupDeleteResponse, error)
- func (s *GroupService) List(ctx context.Context, req GroupListRequest) (*GroupListResponse, error)
- func (s *GroupService) Scale(ctx context.Context, req GroupScaleRequest) (*GroupScaleResponse, error)
- func (s *GroupService) Status(ctx context.Context, req GroupStatusRequest) (*GroupStatusResponse, error)
- type GroupStatusRequest
- type GroupStatusResponse
- type GroupStatusResult
- type NonceRequest
- type NonceResponse
- type NonceService
- type ShardRefreshResult
- type ShardServer
- type ShardStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigRefreshRequest ¶
ConfigRefreshRequest contains parameters for refreshing config.
type ConfigRefreshResponse ¶
type ConfigRefreshResponse struct {
Shards []ShardRefreshResult
}
ConfigRefreshResponse contains results for one or more shards.
type ConfigService ¶
type ConfigService struct {
// contains filtered or unexported fields
}
ConfigService manages configuration operations on Nstance servers.
func NewConfigService ¶
func NewConfigService(connector *Connector) *ConfigService
NewConfigService creates a new ConfigService.
func (*ConfigService) Refresh ¶
func (s *ConfigService) Refresh(ctx context.Context, req ConfigRefreshRequest) (*ConfigRefreshResponse, error)
Refresh triggers configuration refresh on one or more shards.
func (*ConfigService) Status ¶
func (s *ConfigService) Status(ctx context.Context, req ConfigStatusRequest) (*ConfigStatusResponse, error)
Status retrieves configuration status from one or more shards.
type ConfigStatusRequest ¶
ConfigStatusRequest contains parameters for checking config status.
type ConfigStatusResponse ¶
type ConfigStatusResponse struct {
Shards []ShardStatus
}
ConfigStatusResponse contains status for one or more shards.
type Connection ¶
type Connection struct {
Address string
ShardID string
Client proto.OperatorServiceClient
// contains filtered or unexported fields
}
Connection represents an active gRPC connection to a shard server.
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector manages gRPC connections to nstance-servers.
func NewConnector ¶
func NewConnector(servers []ShardServer, tlsConfig *tls.Config, timeout time.Duration, logger *slog.Logger) *Connector
NewConnector creates a new Connector.
func (*Connector) ConnectAll ¶
func (c *Connector) ConnectAll(ctx context.Context) ([]*Connection, error)
ConnectAll connects to all servers in the list.
func (*Connector) ConnectShard ¶
ConnectShard connects to a specific shard by ID.
func (*Connector) GetConnection ¶
GetConnection returns a gRPC connection to any available shard. It tries existing connections first, then attempts to connect to servers.
func (*Connector) Servers ¶
func (c *Connector) Servers() []ShardServer
Servers returns the list of configured servers.
type GroupCreateRequest ¶
type GroupCreateRequest struct {
Shard string
AllShards bool
Group string
Template string
Size int32
InstanceType string
SubnetPool string
Vars map[string]string
}
GroupCreateRequest contains parameters for creating a group.
type GroupCreateResponse ¶
type GroupCreateResponse struct {
Results []GroupCreateResult
}
GroupCreateResponse contains results for one or more shards.
type GroupCreateResult ¶
GroupCreateResult represents the result of creating a group on a shard.
type GroupDeleteRequest ¶
GroupDeleteRequest contains parameters for deleting a group.
type GroupDeleteResponse ¶
type GroupDeleteResponse struct {
Results []GroupDeleteResult
}
GroupDeleteResponse contains results for one or more shards.
type GroupDeleteResult ¶
GroupDeleteResult represents the result of deleting a group on a shard.
type GroupListRequest ¶
GroupListRequest contains parameters for listing groups.
type GroupListResponse ¶
type GroupListResponse struct {
Results []GroupListResult
}
GroupListResponse contains results for one or more shards.
type GroupListResult ¶
type GroupListResult struct {
Shard string
Key string
Size int32
Template string
InstanceType string
IsStatic bool
Error error
}
GroupListResult represents a group from a shard.
type GroupScaleRequest ¶
GroupScaleRequest contains parameters for scaling a group.
type GroupScaleResponse ¶
type GroupScaleResponse struct {
Results []GroupScaleResult
}
GroupScaleResponse contains results for one or more shards.
type GroupScaleResult ¶
GroupScaleResult represents the result of scaling a group.
type GroupService ¶
type GroupService struct {
// contains filtered or unexported fields
}
GroupService manages group operations on Nstance servers.
func NewGroupService ¶
func NewGroupService(connector *Connector) *GroupService
NewGroupService creates a new GroupService.
func (*GroupService) Create ¶
func (s *GroupService) Create(ctx context.Context, req GroupCreateRequest) (*GroupCreateResponse, error)
Create creates a new dynamic group on one or more shards.
func (*GroupService) Delete ¶
func (s *GroupService) Delete(ctx context.Context, req GroupDeleteRequest) (*GroupDeleteResponse, error)
Delete removes a dynamic group from one or more shards.
func (*GroupService) List ¶
func (s *GroupService) List(ctx context.Context, req GroupListRequest) (*GroupListResponse, error)
List returns all groups from one or more shards.
func (*GroupService) Scale ¶
func (s *GroupService) Scale(ctx context.Context, req GroupScaleRequest) (*GroupScaleResponse, error)
Scale updates the size of a group on one or more shards.
func (*GroupService) Status ¶
func (s *GroupService) Status(ctx context.Context, req GroupStatusRequest) (*GroupStatusResponse, error)
Status returns detailed status of a specific group from one or more shards.
type GroupStatusRequest ¶
GroupStatusRequest contains parameters for getting group status.
type GroupStatusResponse ¶
type GroupStatusResponse struct {
Results []GroupStatusResult
}
GroupStatusResponse contains results for one or more shards.
type GroupStatusResult ¶
type GroupStatusResult struct {
Shard string
Key string
Size int32
Template string
InstanceType string
SubnetPool string
Vars map[string]string
IsStatic bool
Error error
}
GroupStatusResult represents detailed status of a group from a shard.
type NonceRequest ¶
NonceRequest contains parameters for generating a registration nonce.
type NonceResponse ¶
type NonceResponse struct {
JWT string
}
NonceResponse contains the generated nonce JWT.
type NonceService ¶
type NonceService struct {
// contains filtered or unexported fields
}
NonceService generates operator registration nonces.
func NewNonceService ¶
func NewNonceService(store secrets.Store) *NonceService
NewNonceService creates a new NonceService.
func (*NonceService) Generate ¶
func (s *NonceService) Generate(ctx context.Context, req NonceRequest) (*NonceResponse, error)
Generate creates a new operator registration nonce JWT.
type ShardRefreshResult ¶
ShardRefreshResult represents the result of refreshing a single shard.
type ShardServer ¶
ShardServer represents a shard and its operator endpoint.
func ParseServersFlag ¶
func ParseServersFlag(servers string) ([]ShardServer, error)
ParseServersFlag parses "shard1=host1:port1,shard2=host2:port2" format.