mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
update run command to run a stub service container on the connected node
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"google.golang.org/grpc"
|
||||
"uncloud/internal/machine/api/pb"
|
||||
"uncloud/internal/machine/docker"
|
||||
)
|
||||
|
||||
// Client is a client for the machine API.
|
||||
@@ -15,8 +16,12 @@ type Client struct {
|
||||
|
||||
pb.MachineClient
|
||||
pb.ClusterClient
|
||||
*DockerClient
|
||||
}
|
||||
|
||||
// DockerClient is a type alias for the Docker client to embed it in Client with a more specific name.
|
||||
type DockerClient = docker.Client
|
||||
|
||||
// Connector is an interface for establishing a connection to the machine API.
|
||||
type Connector interface {
|
||||
Connect(ctx context.Context) (*grpc.ClientConn, error)
|
||||
@@ -37,10 +42,10 @@ func New(ctx context.Context, connector Connector) (*Client, error) {
|
||||
|
||||
c.MachineClient = pb.NewMachineClient(c.conn)
|
||||
c.ClusterClient = pb.NewClusterClient(c.conn)
|
||||
c.DockerClient = docker.NewClient(c.conn)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (c *Client) Close() error {
|
||||
err := c.conn.Close()
|
||||
return errors.Join(err, c.connector.Close())
|
||||
return errors.Join(c.conn.Close(), c.connector.Close())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user