units

package
v0.0.0-...-4a9a2d3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceSection = "Service"
	ExecStartKey   = "ExecStart"
	WorkdirKey     = "WorkingDirectory"
	UserKey        = "User"

	K8sSection   = "X-Kubernetes"
	NamespaceKey = "Namespace"
	PodKey       = "Pod"
	PodUIDKey    = "PodUID"
	ContainerKey = "Container"
)
View Source
const (
	Prefix = "unitlet"
	Suffix = ".service"
	Sep    = "."
)

Variables

This section is empty.

Functions

func ReduceContainerStatuses

func ReduceContainerStatuses(statuses []core.ContainerStatus) core.PodPhase

func ToContainerStatus

func ToContainerStatus(name string, props Properties, state core.ContainerState) core.ContainerStatus

Types

type ID

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

func NewID

func NewID(namespace, pod string, container string) ID

func ParseName

func ParseName(name Name) (ID, error)

func (*ID) Container

func (i *ID) Container() string

func (*ID) Name

func (i *ID) Name() Name

func (*ID) Namespace

func (i *ID) Namespace() string

func (*ID) Pod

func (i *ID) Pod() string

func (*ID) String

func (i *ID) String() string

type Location

type Location string

type Name

type Name string

type Properties

type Properties interface {
	ExitCode() int32
	RestartCount() int32
	StartedAt() meta.Time
	FinishedAt() meta.Time
	ContainerID() *url.URL
}

type State

type State interface {
	Link(ctx context.Context, loc Location) error

	Enable(ctx context.Context, name Name) error
	Disable(ctx context.Context, name Name) error

	Start(ctx context.Context, name Name) error
	Stop(ctx context.Context, name Name) error

	Reload(ctx context.Context) error
	ResetFailed(ctx context.Context, name Name) error

	Views(ctx context.Context) (Views, error)
	Properties(ctx context.Context, name Name) (Properties, error)
}

type Store

type Store interface {
	Location(name Name) Location
	GetUnit(ctx context.Context, name Name) (*Unit, error)
	CreateUnits(ctx context.Context, us []*Unit) error
	DeleteUnit(ctx context.Context, name Name) error
	UpdateUnits(ctx context.Context, us []*Unit) error
}

type Unit

type Unit struct {
	ID     ID
	Cmd    []string
	PodUID types.UID

	Workdir *string
	User    *int64
}

func FromPod

func FromPod(om *meta.ObjectMeta, spec *core.PodSpec) (ret []*Unit)

func (*Unit) Marshal

func (u *Unit) Marshal() ([]byte, error)

func (*Unit) MarshalUnitSections

func (u *Unit) MarshalUnitSections() []*unit.UnitSection

func (*Unit) ToContainer

func (u *Unit) ToContainer() (ret core.Container)

func (*Unit) ToPod

func (u *Unit) ToPod(nodeName string, cs []core.Container, status *core.PodStatus) *core.Pod

func (*Unit) Unmarshal

func (u *Unit) Unmarshal(data []byte) error

func (*Unit) UnmarshalUnitSections

func (u *Unit) UnmarshalUnitSections(ss []*unit.UnitSection) error

type View

type View struct {
	Lead   Name
	Names  []Name
	Status *core.PodStatus
}

type Views

type Views = map[string]map[string]*View

Jump to

Keyboard shortcuts

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