process

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DaemonRecoverPolicy added in v0.3.0

type DaemonRecoverPolicy int
const (
	RecoverPolicyInvalid DaemonRecoverPolicy = iota
	RecoverPolicyNone
	RecoverPolicyRestart
	RecoverPolicyFailover
)

func ParseRecoverPolicy added in v0.3.0

func ParseRecoverPolicy(p string) (DaemonRecoverPolicy, error)

func (DaemonRecoverPolicy) String added in v0.3.0

func (p DaemonRecoverPolicy) String() string

type DaemonStates added in v0.3.0

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

func (*DaemonStates) Add added in v0.3.0

func (s *DaemonStates) Add(daemon *daemon.Daemon) *daemon.Daemon

Return nil if the daemon is never inserted or managed, otherwise returns the previously inserted daemon pointer. Allowing replace an existed daemon since some fields in Daemon can change after restarting nydusd.

func (*DaemonStates) GetByDaemonID added in v0.3.0

func (s *DaemonStates) GetByDaemonID(id string, op func(d *daemon.Daemon)) *daemon.Daemon

func (*DaemonStates) GetBySnapshotID added in v0.3.0

func (s *DaemonStates) GetBySnapshotID(id string, op func(d *daemon.Daemon)) *daemon.Daemon

func (*DaemonStates) List added in v0.3.0

func (s *DaemonStates) List() []*daemon.Daemon

func (*DaemonStates) RecoverDaemonState added in v0.3.0

func (s *DaemonStates) RecoverDaemonState(d *daemon.Daemon)

func (*DaemonStates) Remove added in v0.3.0

func (s *DaemonStates) Remove(d *daemon.Daemon) *daemon.Daemon

func (*DaemonStates) RemoveByDaemonID added in v0.3.0

func (s *DaemonStates) RemoveByDaemonID(id string) *daemon.Daemon

func (*DaemonStates) RemoveBySnapshotID added in v0.3.0

func (s *DaemonStates) RemoveBySnapshotID(id string) *daemon.Daemon

func (*DaemonStates) Size added in v0.3.0

func (s *DaemonStates) Size() int

type FD added in v0.3.0

type FD = uintptr

type LivenessMonitor added in v0.3.0

type LivenessMonitor interface {
	// Subscribe death event of a nydusd daemon.
	// `path` is where the monitor is listening on.
	Subscribe(id string, path string, notifier chan<- deathEvent) error
	// Unsubscribe death event of a nydusd daemon.
	Unsubscribe(id string) error
	// Run the monitor, wait for nydusd death event.
	Run()
	// Stop the monitor and release all the resources.
	Destroy()
}

LivenessMonitor liveness of a nydusd daemon.

type Manager

type Manager struct {

	// TODO: Close me
	LivenessNotifier chan deathEvent
	RecoverPolicy    DaemonRecoverPolicy
	// contains filtered or unexported fields
}

Manage all nydusd daemons. Provide a daemon states cache to avoid frequently operating DB

func NewManager

func NewManager(opt Opt) (*Manager, error)

func (*Manager) CleanUpDaemonResources added in v0.3.0

func (m *Manager) CleanUpDaemonResources(d *daemon.Daemon)

func (*Manager) DeleteBySnapshotID

func (m *Manager) DeleteBySnapshotID(id string)

func (*Manager) DeleteDaemon

func (m *Manager) DeleteDaemon(daemon *daemon.Daemon) error

func (*Manager) DestroyBySnapshotID

func (m *Manager) DestroyBySnapshotID(id string) error

func (*Manager) DestroyDaemon

func (m *Manager) DestroyDaemon(d *daemon.Daemon) error

FIXME: should handle the inconsistent status caused by any step in the function that returns an error.

func (*Manager) GetByDaemonID added in v0.3.0

func (m *Manager) GetByDaemonID(id string) *daemon.Daemon

func (*Manager) GetBySnapshotID

func (m *Manager) GetBySnapshotID(id string) *daemon.Daemon

Daemon state should always be fetched from states cache. DB is only the persistence storage. Daemons manager should never try to read serialized daemon state from DB when running normally. To the function does not try to read DB when daemon is not found.

func (*Manager) IsPrefetchDaemon

func (m *Manager) IsPrefetchDaemon() bool

func (*Manager) IsSharedDaemon

func (m *Manager) IsSharedDaemon() bool

func (*Manager) ListDaemons

func (m *Manager) ListDaemons() []*daemon.Daemon

func (*Manager) NewDaemon

func (m *Manager) NewDaemon(daemon *daemon.Daemon) error

Put a instantiated daemon into states manager. The damon state is put to both states cache and DB. If the daemon with the same daemon ID is already stored, return error ErrAlreadyExists

func (*Manager) Reconnect

func (m *Manager) Reconnect(ctx context.Context) ([]*daemon.Daemon, error)

Reconnect running daemons and rebuild daemons management states 1. Don't erase ever written record 2. Just recover nydusd daemon states to manager's memory part. 3. Manager in SharedDaemon mode should starts a nydusd when recovering

func (*Manager) StartDaemon

func (m *Manager) StartDaemon(d *daemon.Daemon) error

func (*Manager) UpdateDaemon added in v0.3.0

func (m *Manager) UpdateDaemon(daemon *daemon.Daemon) error

type Opt

type Opt struct {
	NydusdBinaryPath string
	Database         *store.Database
	DaemonMode       string
	CacheDir         string
	RecoverPolicy    DaemonRecoverPolicy
}

type Store

type Store interface {
	GetByDaemonID(id string) (*daemon.Daemon, error)
	GetBySnapshotID(snapshotID string) (*daemon.Daemon, error)
	// If the daemon is inserted to DB before, return error ErrAlreadyExisted.
	Add(*daemon.Daemon) error
	Update(d *daemon.Daemon) error
	Delete(*daemon.Daemon) error
	WalkDaemons(ctx context.Context, cb func(*daemon.Daemon) error) error
	CleanupDaemons(ctx context.Context) error
}

Nydus daemons and snapshots persistence storage.

Jump to

Keyboard shortcuts

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