Documentation ¶
Index ¶
- type DaemonStates
- func (s *DaemonStates) Add(daemon *daemon.Daemon) *daemon.Daemon
- func (s *DaemonStates) GetByDaemonID(id string, op func(d *daemon.Daemon)) *daemon.Daemon
- func (s *DaemonStates) List() []*daemon.Daemon
- func (s *DaemonStates) RecoverDaemonState(d *daemon.Daemon)
- func (s *DaemonStates) Remove(d *daemon.Daemon) *daemon.Daemon
- func (s *DaemonStates) RemoveByDaemonID(id string) *daemon.Daemon
- func (s *DaemonStates) Size() int
- type FD
- type LivenessMonitor
- type Manager
- func (m *Manager) BuildDaemonCommand(d *daemon.Daemon, bin string, upgrade bool) (*exec.Cmd, error)
- func (m *Manager) CacheDir() string
- func (m *Manager) CleanUpDaemonResources(d *daemon.Daemon)
- func (m *Manager) DeleteDaemon(daemon *daemon.Daemon) error
- func (m *Manager) DestroyDaemon(d *daemon.Daemon) error
- func (m *Manager) GetByDaemonID(id string) *daemon.Daemon
- func (m *Manager) IsSharedDaemon() bool
- func (m *Manager) ListDaemons() []*daemon.Daemon
- func (m *Manager) Lock()
- func (m *Manager) NewDaemon(daemon *daemon.Daemon) error
- func (m *Manager) NewInstance(r *daemon.Rafs) error
- func (m *Manager) Recover(ctx context.Context) (map[string]*daemon.Daemon, map[string]*daemon.Daemon, error)
- func (m *Manager) RemoveInstance(snapshotID string) error
- func (m *Manager) StartDaemon(d *daemon.Daemon) error
- func (m *Manager) SubscribeDaemonEvent(d *daemon.Daemon) error
- func (m *Manager) Unlock()
- func (m *Manager) UnsubscribeDaemonEvent(d *daemon.Daemon) error
- func (m *Manager) UpdateDaemon(daemon *daemon.Daemon) error
- func (m *Manager) UpdateDaemonNoLock(daemon *daemon.Daemon) error
- type Opt
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DaemonStates ¶
type DaemonStates struct {
// contains filtered or unexported fields
}
func (*DaemonStates) Add ¶
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 ¶
func (*DaemonStates) List ¶
func (s *DaemonStates) List() []*daemon.Daemon
func (*DaemonStates) RecoverDaemonState ¶
func (s *DaemonStates) RecoverDaemonState(d *daemon.Daemon)
Also recover daemon runtime state here
func (*DaemonStates) RemoveByDaemonID ¶
func (s *DaemonStates) RemoveByDaemonID(id string) *daemon.Daemon
func (*DaemonStates) Size ¶
func (s *DaemonStates) Size() int
type LivenessMonitor ¶
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 { NydusdBinaryPath string // TODO: Close me LivenessNotifier chan deathEvent RecoverPolicy config.DaemonRecoverPolicy SupervisorSet *supervisor.SupervisorsSet // A basic configuration template loaded from the file DaemonConfig daemonconfig.DaemonConfig // In order to validate daemon fs driver is consistent with the latest snapshotter boot FsDriver string // contains filtered or unexported fields }
Manage all nydusd daemons. Provide a daemon states cache to avoid frequently operating DB
func NewManager ¶
func (*Manager) BuildDaemonCommand ¶
Build a daemon command which will be started to fork a new nydusd process later according to previously setup daemon object.
func (*Manager) CleanUpDaemonResources ¶
func (*Manager) DestroyDaemon ¶
FIXME: should handle the inconsistent status caused by any step in the function that returns an error.
func (*Manager) IsSharedDaemon ¶
func (*Manager) ListDaemons ¶
func (*Manager) NewDaemon ¶
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) Recover ¶
func (m *Manager) Recover(ctx context.Context) (map[string]*daemon.Daemon, map[string]*daemon.Daemon, error)
Recover running daemons and rebuild daemons management states It is invoked during nydus-snapshotter restarting 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) RemoveInstance ¶
func (*Manager) StartDaemon ¶
Fork the nydusd daemon with the process PID decided
func (*Manager) SubscribeDaemonEvent ¶
func (*Manager) UnsubscribeDaemonEvent ¶
type Opt ¶
type Opt struct { NydusdBinaryPath string Database *store.Database DaemonMode config.DaemonMode CacheDir string RecoverPolicy config.DaemonRecoverPolicy // Nydus-snapshotter work directory RootDir string DaemonConfig daemonconfig.DaemonConfig // In order to validate daemon fs driver is consistent with the latest snapshotter boot FsDriver string }
type Store ¶
type Store interface { // If the daemon is inserted to DB before, return error ErrAlreadyExisted. AddDaemon(d *daemon.Daemon) error UpdateDaemon(d *daemon.Daemon) error DeleteDaemon(id string) error WalkDaemons(ctx context.Context, cb func(*daemon.States) error) error CleanupDaemons(ctx context.Context) error AddInstance(r *daemon.Rafs) error DeleteInstance(snapshotID string) error WalkInstances(ctx context.Context, cb func(*daemon.Rafs) error) error NextInstanceSeq() (uint64, error) }
Nydus daemons and fs instances persistence storage.