corroservice

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUser       = "uncloud"
	DefaultGossipPort = 51001
	DefaultAPIPort    = 51002
)
View Source
const (
	DefaultCommand = "corrosion"
	DefaultDataDir = "/var/lib/uncloud/corrosion"
)
View Source
const DefaultSystemdUnit = "uncloud-corrosion.service"
View Source
const (
	LatestImage = "ghcr.io/psviderski/corrosion:latest"
)

Variables

This section is empty.

Functions

func MkDataDir

func MkDataDir(dir, owner string) error

Types

type APIConfig

type APIConfig struct {
	Addr netip.AddrPort `toml:"addr"`
}

type AdminConfig

type AdminConfig struct {
	Path string `toml:"path"`
}

type Config

type Config struct {
	DB     DBConfig     `toml:"db"`
	Gossip GossipConfig `toml:"gossip"`
	API    APIConfig    `toml:"api"`
	Admin  AdminConfig  `toml:"admin"`
}

Config represents the Corrosion config.

func (*Config) Write

func (c *Config) Write(path, owner string) error

type DBConfig

type DBConfig struct {
	Path        string   `toml:"path"`
	SchemaPaths []string `toml:"schema_paths"`
}

type DockerService

type DockerService struct {
	Client  *client.Client
	Image   string
	Name    string
	DataDir string
	User    string
}

func NewDockerService

func NewDockerService(cli *client.Client, image, name, dataDir string) *DockerService

func (*DockerService) Restart

func (s *DockerService) Restart(ctx context.Context) error

func (*DockerService) Running

func (s *DockerService) Running() bool

func (*DockerService) Start

func (s *DockerService) Start(ctx context.Context) error

type GossipConfig

type GossipConfig struct {
	Addr      netip.AddrPort `toml:"addr"`
	Bootstrap []string       `toml:"bootstrap"`
	Plaintext bool           `toml:"plaintext"`
}

type Service

type Service interface {
	Start(ctx context.Context) error
	Restart(ctx context.Context) error
	Running() bool
}

type SubprocessService

type SubprocessService struct {
	Command string
	DataDir string
	// contains filtered or unexported fields
}

SubprocessService implements the Service interface by running the service as a subprocess.

func DefaultSubprocessService

func DefaultSubprocessService() *SubprocessService

func (*SubprocessService) Restart

func (s *SubprocessService) Restart(ctx context.Context) error

func (*SubprocessService) Running

func (s *SubprocessService) Running() bool

func (*SubprocessService) Start

func (s *SubprocessService) Start(ctx context.Context) error

TODO: maybe stop the process if this ctx is cancelled.

type SystemdService

type SystemdService struct {
	DataDir string
	Unit    string
	// contains filtered or unexported fields
}

func DefaultSystemdService

func DefaultSystemdService(dataDir string) *SystemdService

func (*SystemdService) Restart

func (s *SystemdService) Restart(ctx context.Context) error

func (*SystemdService) Running

func (s *SystemdService) Running() bool

func (*SystemdService) Start

func (s *SystemdService) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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