remote

package
v0.0.0-...-54b4948 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 35 Imported by: 5

Documentation

Index

Constants

View Source
const (
	LoggingCacheCreateCommand         = "logging_cache_create"
	LoggingCacheGetCommand            = "logging_cache_get"
	LoggingCacheRemoveCommand         = "logging_cache_remove"
	LoggingCacheCloseAndRemoveCommand = "logging_cache_close_and_remove"
	LoggingCacheClearCommand          = "logging_cache_clear"
	LoggingCachePruneCommand          = "logging_cache_prune"
	LoggingCacheLenCommand            = "logging_cache_len"
)

Constants representing logging cache commands.

View Source
const (
	ManagerIDCommand     = "id"
	CreateProcessCommand = "create_process"
	GetProcessCommand    = "get_process"
	ListCommand          = "list"
	GroupCommand         = "group"
	ClearCommand         = "clear"
	CloseCommand         = "close"
	WriteFileCommand     = "write_file"
)

Constants representing manager commands.

View Source
const (
	ConfigureCacheCommand     = "configure_cache"
	DownloadFileCommand       = "download_file"
	DownloadMongoDBCommand    = "download_mongodb"
	GetLogStreamCommand       = "get_log_stream"
	GetBuildloggerURLsCommand = "get_buildlogger_urls"
	SignalEventCommand        = "signal_event"
	SendMessagesCommand       = "send_messages"
)

Constants representing remote client commands.

View Source
const (
	ProcessIDCommand               = "process_id"
	InfoCommand                    = "info"
	RunningCommand                 = "running"
	CompleteCommand                = "complete"
	WaitCommand                    = "wait"
	RespawnCommand                 = "respawn"
	SignalCommand                  = "signal"
	RegisterSignalTriggerIDCommand = "register_signal_trigger_id"
	GetTagsCommand                 = "get_tags"
	TagCommand                     = "add_tag"
	ResetTagsCommand               = "reset_tags"
)

Constants representing process commands.

Variables

View Source
var ErrLoggingCacheNotSupported = errors.New("logging cache is not supported")

ErrLoggingCacheNotSupported is an error indicating that the remote interface does not have a logging cache available.

Functions

func AttachService

func AttachService(ctx context.Context, manager jasper.Manager, s *grpc.Server) error

AttachService attaches the jasper GRPC server to the given manager. After this function successfully returns, calls to Manager functions will be sent over GRPC to the Jasper GRPC server.

func StartMDBService

func StartMDBService(ctx context.Context, m jasper.Manager, addr net.Addr) (util.CloseFunc, error)

StartMDBService wraps an existing Jasper manager in a MongoDB wire protocol service and starts it. The caller is responsible for closing the connection using the returned jasper.CloseFunc.

func StartRPCService

func StartRPCService(ctx context.Context, manager jasper.Manager, addr net.Addr, creds *certdepot.Credentials) (util.CloseFunc, error)

StartRPCService starts an RPC server with the specified address addr around the given manager. If creds is non-nil, the credentials will be used to establish a secure TLS connection with clients; otherwise, it will start an insecure service. The caller is responsible for closing the connection using the returned jasper.CloseFunc.

func StartRPCServiceWithFile

func StartRPCServiceWithFile(ctx context.Context, manager jasper.Manager, addr net.Addr, filePath string) (util.CloseFunc, error)

StartRPCServiceWithFile is the same as StartService, but the credentials will be read from the file given by filePath if the filePath is non-empty. The credentials file should contain the JSON-encoded bytes from (*certdepot.Credentials).Export().

Types

type Manager

type Manager interface {
	jasper.Manager

	CloseConnection() error
	ConfigureCache(ctx context.Context, opts options.Cache) error
	DownloadFile(ctx context.Context, opts options.Download) error
	DownloadMongoDB(ctx context.Context, opts options.MongoDBDownload) error
	GetLogStream(ctx context.Context, id string, count int) (jasper.LogStream, error)
	GetBuildloggerURLs(ctx context.Context, id string) ([]string, error)
	SignalEvent(ctx context.Context, name string) error
	SendMessages(context.Context, options.LoggingPayload) error
}

Manager provides an interface to access all functionality from a Jasper service. It includes an interface to interact with Jasper Managers and Processes remotely as well as access to remote-specific functionality.

func NewMDBClient

func NewMDBClient(ctx context.Context, addr net.Addr, reqTimeout time.Duration) (Manager, error)

NewMDBClient returns a remote client for connection to a MongoDB wire protocol service. reqTimeout specifies the timeout for a request, or uses a default timeout if zero.

func NewRESTClient

func NewRESTClient(addr net.Addr) Manager

NewRESTClient creates a REST client with a new HTTP client that connects to the given address running the Jasper REST service. The HTTP client should be cleaned up by calling CloseConnection.

func NewRESTClientWithExistingClient

func NewRESTClientWithExistingClient(addr net.Addr, client *http.Client) Manager

NewRESTClientWithExistingClient creates a REST client that uses an existing HTTP client to connect to the given address running the Jasper REST service. This does not take ownership of the HTTP client, so the HTTP client is not cleaned up when CloseConnection is called.

func NewRPCClient

func NewRPCClient(ctx context.Context, addr net.Addr, creds *certdepot.Credentials) (Manager, error)

NewRPCClient creates a connection to the RPC service with the specified address addr. If creds is non-nil, the credentials will be used to establish a secure TLS connection with the service; otherwise, it will establish an insecure connection. The caller is responsible for closing the connection using the returned jasper.CloseFunc.

func NewRPCClientWithFile

func NewRPCClientWithFile(ctx context.Context, addr net.Addr, filePath string) (Manager, error)

NewRPCClientWithFile is the same as NewRPCClient but the credentials will be read from the file given by filePath if the filePath is non-empty. The credentials file should contain the JSON-encoded bytes from (*certdepot.Credentials).Export().

type Service

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

Service defines a REST service that provides a remote manager, using gimlet to publish routes.

func NewRESTService

func NewRESTService(m jasper.Manager) *Service

NewRESTService creates a service object around an existing manager. You must access the application and routes via the App() method separately.

func (*Service) App

func (s *Service) App(ctx context.Context) *gimlet.APIApp

App constructs and returns a gimlet application for this service. It attaches no middleware and does not start the service.

func (*Service) SetCacheMaxSize

func (s *Service) SetCacheMaxSize(size int)

SetCacheMaxSize sets the underlying option for the services cache.

func (*Service) SetDisableCachePruning

func (s *Service) SetDisableCachePruning(v bool)

SetDisableCachePruning toggles the underlying option for the services cache.

func (*Service) SetPruneDelay

func (s *Service) SetPruneDelay(dur time.Duration)

SetPruneDelay sets the underlying option for the services cache.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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