services

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: MPL-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseService

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

BaseService is a base implementation of the Service interface

func (*BaseService) GetAddress

func (s *BaseService) GetAddress() string

GetAddress returns the current address of the service

func (*BaseService) GetHostname added in v0.3.0

func (s *BaseService) GetHostname() string

GetHostname returns the name plus the tld from the config

func (*BaseService) GetName

func (s *BaseService) GetName() string

GetName returns the current name of the service

func (*BaseService) Initialize

func (s *BaseService) Initialize() error

Initialize is a no-op for the Service interface

func (*BaseService) SetAddress

func (s *BaseService) SetAddress(address string) error

SetAddress sets the address if it is a valid IPv4 address

func (*BaseService) SetName

func (s *BaseService) SetName(name string)

SetName sets the name of the service

func (*BaseService) WriteConfig

func (s *BaseService) WriteConfig() error

WriteConfig is a no-op for the Service interface

type DNSService

type DNSService struct {
	BaseService
	// contains filtered or unexported fields
}

DNSService handles DNS configuration

func NewDNSService

func NewDNSService(injector di.Injector) *DNSService

NewDNSService creates a new DNSService

func (*DNSService) GetComposeConfig

func (s *DNSService) GetComposeConfig() (*types.Config, error)

GetComposeConfig returns the compose configuration

func (*DNSService) Initialize

func (s *DNSService) Initialize() error

Initialize resolves and sets all the things resolved from the DI

func (*DNSService) SetAddress

func (s *DNSService) SetAddress(address string) error

SetAddress sets the address for the DNS service

func (*DNSService) WriteConfig

func (s *DNSService) WriteConfig() error

WriteConfig writes any necessary configuration files needed by the service

type GitLivereloadService

type GitLivereloadService struct {
	BaseService
}

GitLivereloadService is a service struct that provides various utility functions

func NewGitLivereloadService

func NewGitLivereloadService(injector di.Injector) *GitLivereloadService

NewGitLivereloadService is a constructor for GitLivereloadService

func (*GitLivereloadService) GetComposeConfig

func (s *GitLivereloadService) GetComposeConfig() (*types.Config, error)

GetComposeConfig returns the top-level compose configuration including a list of container data for docker-compose.

type LocalstackService

type LocalstackService struct {
	BaseService
}

LocalstackService is a service struct that provides Localstack-specific utility functions

func NewLocalstackService

func NewLocalstackService(injector di.Injector) *LocalstackService

NewLocalstackService is a constructor for LocalstackService

func (*LocalstackService) GetComposeConfig

func (s *LocalstackService) GetComposeConfig() (*types.Config, error)

GetComposeConfig returns the top-level compose configuration including a list of container data for docker-compose.

type MockService

type MockService struct {
	BaseService
	// GetComposeConfigFunc is a function that mocks the GetComposeConfig method
	GetComposeConfigFunc func() (*types.Config, error)
	// WriteConfigFunc is a function that mocks the WriteConfig method
	WriteConfigFunc func() error
	// SetAddressFunc is a function that mocks the SetAddress method
	SetAddressFunc func(address string) error
	// GetAddressFunc is a function that mocks the GetAddress method
	GetAddressFunc func() string
	// InitializeFunc is a function that mocks the Initialize method
	InitializeFunc func() error
	// SetNameFunc is a function that mocks the SetName method
	SetNameFunc func(name string)
	// GetNameFunc is a function that mocks the GetName method
	GetNameFunc func() string
	// GetHostnameFunc is a function that mocks the GetHostname method
	GetHostnameFunc func() string
}

MockService is a mock implementation of the Service interface

func NewMockService

func NewMockService() *MockService

NewMockService is a constructor for MockService

func (*MockService) GetAddress

func (m *MockService) GetAddress() string

GetAddress calls the mock GetAddressFunc if it is set, otherwise returns an empty string

func (*MockService) GetComposeConfig

func (m *MockService) GetComposeConfig() (*types.Config, error)

GetComposeConfig calls the mock GetComposeConfigFunc if it is set, otherwise returns nil

func (*MockService) GetHostname added in v0.3.0

func (m *MockService) GetHostname() string

GetHostname calls the mock GetHostnameFunc if it is set, otherwise returns an empty string

func (*MockService) GetName

func (m *MockService) GetName() string

GetName calls the mock GetNameFunc if it is set, otherwise returns an empty string

func (*MockService) Initialize

func (m *MockService) Initialize() error

Initialize calls the mock InitializeFunc if it is set, otherwise returns nil

func (*MockService) SetAddress

func (m *MockService) SetAddress(address string) error

SetAddress calls the mock SetAddressFunc if it is set, otherwise returns nil

func (*MockService) SetName

func (m *MockService) SetName(name string)

SetName calls the mock SetNameFunc if it is set

func (*MockService) WriteConfig

func (m *MockService) WriteConfig() error

WriteConfig calls the mock WriteConfigFunc if it is set, otherwise returns nil

type RegistryService

type RegistryService struct {
	BaseService
	// contains filtered or unexported fields
}

RegistryService is a service struct that provides Registry-specific utility functions

func NewRegistryService

func NewRegistryService(injector di.Injector) *RegistryService

NewRegistryService is a constructor for RegistryService

func (*RegistryService) GetComposeConfig

func (s *RegistryService) GetComposeConfig() (*types.Config, error)

GetComposeConfig returns a compose configuration for the registry matching the current s.name value.

func (*RegistryService) GetHostname added in v0.3.0

func (s *RegistryService) GetHostname() string

GetHostname returns the hostname of the registry service. This is constructed by removing the existing tld from the name and appending the configured tld.

func (*RegistryService) SetAddress

func (s *RegistryService) SetAddress(address string) error

SetAddress configures the registry address, forms a hostname, updates the registry config, and returns an error if any step fails. It appends the TLD to the service name to form the hostname.

type Service

type Service interface {
	// GetComposeConfig returns the top-level compose configuration including a list of container data for docker-compose.
	GetComposeConfig() (*types.Config, error)

	// WriteConfig writes any necessary configuration files needed by the service
	WriteConfig() error

	// SetAddress sets the address if it is a valid IPv4 address
	SetAddress(address string) error

	// GetAddress returns the current address of the service
	GetAddress() string

	// SetName sets the name of the service
	SetName(name string)

	// GetName returns the current name of the service
	GetName() string

	// Initialize performs any necessary initialization for the service.
	Initialize() error

	// GetHostname returns the name plus the tld from the config
	GetHostname() string
}

Service is an interface that defines methods for retrieving environment variables and can be implemented for individual providers.

type TalosControlPlaneService

type TalosControlPlaneService struct {
	BaseService
}

func NewTalosControlPlaneService

func NewTalosControlPlaneService(injector di.Injector) *TalosControlPlaneService

NewTalosControlPlaneService is a constructor for TalosControlPlaneService

func (*TalosControlPlaneService) GetComposeConfig

func (s *TalosControlPlaneService) GetComposeConfig() (*types.Config, error)

GetComposeConfig returns a list of container data for docker-compose.

func (*TalosControlPlaneService) SetAddress

func (s *TalosControlPlaneService) SetAddress(address string) error

SetAddress sets the address of the service This turns out to be a convenient place to set node information

type TalosWorkerService

type TalosWorkerService struct {
	BaseService
	// contains filtered or unexported fields
}

func NewTalosWorkerService

func NewTalosWorkerService(injector di.Injector) *TalosWorkerService

NewTalosWorkerService is a constructor for TalosWorkerService

func (*TalosWorkerService) GetComposeConfig

func (s *TalosWorkerService) GetComposeConfig() (*types.Config, error)

GetComposeConfig returns a list of container data for docker-compose. It retrieves CPU and RAM settings for workers from the configuration and determines the port for the endpoint. The function ensures the project root's .volumes folder exists and sets up a common configuration for Talos containers. Finally, it creates a single worker service and includes volume specifications in the compose config.

func (*TalosWorkerService) SetAddress

func (s *TalosWorkerService) SetAddress(address string) error

SetAddress configures the network address for the Talos worker service. It also sets node-specific information such as hostname and endpoint in the configuration. If the address is localhost (127.0.0.1), it assigns a unique port starting from 50001.

Jump to

Keyboard shortcuts

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