client

package
v0.0.0-...-3bfe646 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the RPC client

func New

func New(ctx context.Context, config Config) (*Client, error)

New establishes connection to remote gRPC server note that if connection is unavailable, it will try to establish it until context provided expires

func NewFromConn

func NewFromConn(conn *grpc.ClientConn) *Client

NewFromConn creates a new client based on existing connection conn

func (*Client) Abort

func (c *Client) Abort(ctx context.Context) error

Abort requests remote agent to abort operation

func (*Client) CheckBandwidth

CheckBandwidth executes a network bandwidth test

func (*Client) CheckDisks

CheckDisks executes disk performance test.

func (*Client) CheckPorts

CheckPorts executes a network port test

func (*Client) Close

func (c *Client) Close() error

Close closes the underlying connection

func (*Client) Command

func (c *Client) Command(ctx context.Context, log logrus.FieldLogger, stdout, stderr io.Writer, args ...string) error

Command executes the command specified with args on remote node

func (*Client) GetCurrentTime

func (c *Client) GetCurrentTime(ctx context.Context) (*time.Time, error)

GetCurrentTime returns agent's current time as UTC timestamp

func (*Client) GetRuntimeConfig

func (c *Client) GetRuntimeConfig(ctx context.Context) (*pb.RuntimeConfig, error)

GetRuntimeConfig returns agent's runtime configuration

func (*Client) GetSystemInfo

func (c *Client) GetSystemInfo(ctx context.Context) (storage.System, error)

GetSystemInfo queries remote system information

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context) (*pb.Version, error)

GetVersion returns agent's version information

func (*Client) GravityCommand

func (c *Client) GravityCommand(ctx context.Context, log logrus.FieldLogger, stdout, stderr io.Writer, args ...string) error

GravityCommand executes the gravity command specified with args on remote node. The command uses the same gravity binary that runs the agent.

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context, req *pb.ShutdownRequest) error

Shutdown requests remote agent to quit

func (*Client) Validate

func (c *Client) Validate(ctx context.Context, req *validationpb.ValidateRequest) ([]*agentpb.Probe, error)

Validate validates the node against the specified manifest and profile. Returns the list of failed probes

type Config

type Config struct {
	// Credentials specifies connect credentials
	Credentials credentials.TransportCredentials
	// ServerAddr specifies the address of the remote node as host:port
	ServerAddr string
}

Config defines configuration to connect to a remote RPC agent

type Interface

type Interface interface {
	// Command executes the command specified with args remotely
	Command(ctx context.Context, log logrus.FieldLogger, stdout, stderr io.Writer, args ...string) error
	// GravityCommand executes the gravity command specified with args remotely
	GravityCommand(ctx context.Context, log logrus.FieldLogger, stdout, stderr io.Writer, args ...string) error
	// Validate validates the node against the specified manifest and profile.
	// Returns the list of failed probes
	Validate(ctx context.Context, req *validationpb.ValidateRequest) ([]*agentpb.Probe, error)
	// GetSystemInfo queries remote system information
	GetSystemInfo(context.Context) (storage.System, error)
	// GetRuntimeConfig returns agent's runtime configuration
	GetRuntimeConfig(context.Context) (*pb.RuntimeConfig, error)
	// GetCurrentTime returns agent's current time as UTC timestamp
	GetCurrentTime(context.Context) (*time.Time, error)
	// GetVersion returns agent's version information
	GetVersion(context.Context) (*pb.Version, error)
	// CheckPorts executes a network port test
	CheckPorts(context.Context, *validationpb.CheckPortsRequest) (*validationpb.CheckPortsResponse, error)
	// CheckBandwidth executes a network bandwidth test
	CheckBandwidth(context.Context, *validationpb.CheckBandwidthRequest) (*validationpb.CheckBandwidthResponse, error)
	// CheckDisks executes disk performance test
	CheckDisks(context.Context, *validationpb.CheckDisksRequest) (*validationpb.CheckDisksResponse, error)
	// Shutdown requests remote agent to shut down
	Shutdown(context.Context, *pb.ShutdownRequest) error
	// Abort requests remote agent to uninstall
	Abort(context.Context) error
	// Close will close communication with remote agent
	Close() error
}

Interface is high level RPC agent interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL