Documentation
¶
Index ¶
- type DaemonRecoverPolicy
- 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) GetBySnapshotID(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) RemoveBySnapshotID(id string) *daemon.Daemon
- func (s *DaemonStates) Size() int
- type FD
- type LivenessMonitor
- type Manager
- func (m *Manager) CleanUpDaemonResources(d *daemon.Daemon)
- func (m *Manager) DeleteBySnapshotID(id string)
- func (m *Manager) DeleteDaemon(daemon *daemon.Daemon) error
- func (m *Manager) DestroyBySnapshotID(id string) error
- func (m *Manager) DestroyDaemon(d *daemon.Daemon) error
- func (m *Manager) GetByDaemonID(id string) *daemon.Daemon
- func (m *Manager) GetBySnapshotID(id string) *daemon.Daemon
- func (m *Manager) IsPrefetchDaemon() bool
- func (m *Manager) IsSharedDaemon() bool
- func (m *Manager) ListDaemons() []*daemon.Daemon
- func (m *Manager) NewDaemon(daemon *daemon.Daemon) error
- func (m *Manager) Reconnect(ctx context.Context) ([]*daemon.Daemon, error)
- func (m *Manager) StartDaemon(d *daemon.Daemon) error
- func (m *Manager) UpdateDaemon(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 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 (*DaemonStates) GetBySnapshotID ¶ added in v0.3.0
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 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 (*Manager) CleanUpDaemonResources ¶ added in v0.3.0
func (*Manager) DeleteBySnapshotID ¶
func (*Manager) DestroyBySnapshotID ¶
func (*Manager) DestroyDaemon ¶
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 (*Manager) GetBySnapshotID ¶
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 (*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
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.