job_distributor

package
v1.51.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JDContainerName            string = "job-distributor"
	DEAFULTJDContainerPort     string = "42242"
	DEFAULTCSAKeyEncryptionKey string = "!PASsword000!"
	DEAFULTWSRPCContainerPort  string = "8080"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	test_env.EnvComponent
	Grpc          string
	Wsrpc         string
	InternalGRPC  string
	InternalWSRPC string
	// contains filtered or unexported fields
}

func New

func New(networks []string, opts ...Option) *Component

New creates a new Component instance with a unique container name and specified networks. It allows for optional configuration through functional options and sets default values for various parameters. This function is useful for initializing components in a test environment.

func (*Component) RestartContainer

func (j *Component) RestartContainer() error

RestartContainer restarts the container associated with the Component. It ensures that the container is started with the option to reuse resources, making it useful for maintaining service continuity during updates or failures.

func (*Component) StartContainer

func (j *Component) StartContainer() error

StartContainer initializes and starts a container for the component. It ensures the container is ready for use, logging relevant connection details. This function is essential for setting up the environment required for the component's operations.

type Option

type Option = func(j *Component)

func WithCSAKeyEncryptionKey

func WithCSAKeyEncryptionKey(key string) Option

WithCSAKeyEncryptionKey sets the CSA key encryption key for a Component. This function is useful for configuring secure key management in decentralized applications.

func WithContainerName

func WithContainerName(name string) Option

WithContainerName sets the container name for a Component. It returns an Option that can be used to configure the Component during initialization.

func WithContainerPort

func WithContainerPort(port string) Option

WithContainerPort sets the container port for a Component. This option allows customization of the network configuration for the container, enabling proper communication with external services.

func WithDBURL

func WithDBURL(db string) Option

WithDBURL returns an Option that sets the database connection URL for a Component. It allows users to configure the Component with a specific database connection string.

func WithImage

func WithImage(image string) Option

WithImage sets the container image for a Component. This option allows users to specify which image to use, enabling customization of the component's runtime environment.

func WithTestInstance

func WithTestInstance(t *testing.T) Option

WithTestInstance sets up a test logger and test context for a Component. It is useful for initializing components in unit tests, ensuring that logs are captured and associated with the provided testing.T instance.

func WithVersion

func WithVersion(version string) Option

WithVersion sets the container version for a Component. It allows users to specify the desired version, ensuring the Component runs with the correct configuration.

func WithWSRPCContainerPort

func WithWSRPCContainerPort(port string) Option

WithWSRPCContainerPort sets the WebSocket RPC port for the Component. This option allows users to configure the port for WebSocket communication, enabling flexibility in service deployment and integration.

Jump to

Keyboard shortcuts

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