grpc

package
v0.1.2-0...-eb23d83 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConnectionRefused = errors.New("server refused connection")

Functions

func GetConfigFromContext

func GetConfigFromContext(ctx context.Context) any

func Init

func Init(grpcContext context.Context,
	appConfig *config.CommonConfiguration,
	secrets config.SecretStore,
	workerFuncs *WorkerFunctions,
) error

func WithGRPCConfig

func WithGRPCConfig(parentContext context.Context, cfg any) context.Context

Types

type AgentGrpcError

type AgentGrpcError struct {
	Context    context.Context
	InnerError error
}

func (*AgentGrpcError) Error

func (e *AgentGrpcError) Error() string

type ClientLoop

type ClientLoop struct {
	Ctx         context.Context
	WorkerFuncs WorkerFunctions
	Secrets     config.SecretStore

	AppConfig *config.CommonConfiguration
	NodeID    string
	// contains filtered or unexported fields
}

type Connection

type Connection struct {
	Conn   *grpc.ClientConn
	Client agent.AgentClient
}

func (*Connection) SetClient

func (g *Connection) SetClient(client agent.AgentClient)

func (*Connection) SetConn

func (g *Connection) SetConn(conn *grpc.ClientConn)

type ContainerCommandFunc

type ContainerCommandFunc func(context.Context, *common.ContainerCommandRequest) error

type ContainerInspectFunc

type ContainerInspectFunc func(context.Context, *agent.ContainerInspectRequest) (string, error)

type ContainerLogEvent

type ContainerLogEvent struct {
	Error   error
	Message string
}

type ContainerLogReader

type ContainerLogReader interface {
	Next() <-chan ContainerLogEvent
	Close() error
}

type ContainerLogStream

type ContainerLogStream struct {
	Reader ContainerLogReader
	Echo   bool
}

type ContainerStatusStream

type ContainerStatusStream struct {
	Events chan []*common.ContainerStateItem
	Error  chan error
}

type DeleteContainersFunc

type DeleteContainersFunc func(context.Context, *common.DeleteContainersRequest) error

type DeleteFunc

type DeleteFunc func(context.Context, string, string) error

type DeploySharedSecretsFunc

type DeploySharedSecretsFunc func(context.Context, string, map[string]string) error

type GetSelfContainerNameFunc

type GetSelfContainerNameFunc func(context.Context) (string, error)

type ReplaceTokenFunc

type ReplaceTokenFunc func(context.Context, *agent.ReplaceTokenRequest) error

type SecretListFunc

type SecretListFunc func(context.Context, string, string) ([]string, error)

type SendLogFunc

type SendLogFunc func(string) error

type UpdateOptions

type UpdateOptions struct {
	// always execute the update, regardless of the actual version
	UpdateAlways bool
	// if false will not restart by itself, only a message printed about the token events
	UseContainers bool
}

UpdateOptions options to increase update testability

type WatchContainerStatusFunc

type WatchContainerStatusFunc func(context.Context, string, bool) (*ContainerStatusStream, error)

type WorkerFunctions

type WorkerFunctions struct {
	Deploy               DeployFunc
	DeploySharedSecrets  DeploySharedSecretsFunc
	WatchContainerStatus WatchContainerStatusFunc
	Delete               DeleteFunc
	SecretList           SecretListFunc
	SelfUpdate           SelfUpdateFunc
	GetSelfContainerName GetSelfContainerNameFunc
	Close                CloseFunc
	ContainerCommand     ContainerCommandFunc
	DeleteContainers     DeleteContainersFunc
	ContainerLog         ContainerLogFunc
	ContainerInspect     ContainerInspectFunc
}

Jump to

Keyboard shortcuts

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