package daemon
import "github.com/containerd/nydus-snapshotter/pkg/daemon"
Index ¶
- Constants
- func WaitUntilSocketExisted(sock string, pid int) error
- type ConfigState
- type Daemon
- func NewDaemon(opt ...NewDaemonOpt) (*Daemon, error)
- func (d *Daemon) AddRafsInstance(r *rafs.Rafs)
- func (d *Daemon) ClearVestige()
- func (d *Daemon) CloneRafsInstances(src *Daemon)
- func (d *Daemon) ConfigFile(instanceID string) string
- func (d *Daemon) DecRef() int32
- func (d *Daemon) Exit() error
- func (d *Daemon) GetAPISock() string
- func (d *Daemon) GetCacheMetrics(sid string) (*types.CacheMetrics, error)
- func (d *Daemon) GetClient() (NydusdClient, error)
- func (d *Daemon) GetDaemonInfo() (*types.DaemonInfo, error)
- func (d *Daemon) GetFsMetrics(sid string) (*types.FsMetrics, error)
- func (d *Daemon) GetInflightMetrics() (*types.InflightMetrics, error)
- func (d *Daemon) GetRef() int32
- func (d *Daemon) GetState() (types.DaemonState, error)
- func (d *Daemon) HostMountpoint() (mnt string)
- func (d *Daemon) ID() string
- func (d *Daemon) IncRef()
- func (d *Daemon) IsSharedDaemon() bool
- func (d *Daemon) Lock()
- func (d *Daemon) LogFile() string
- func (d *Daemon) NydusdThreadNum() int
- func (d *Daemon) Pid() int
- func (d *Daemon) RecoverRafsInstances() error
- func (d *Daemon) RemoveRafsInstance(snapshotID string)
- func (d *Daemon) ResetClient()
- func (d *Daemon) ResetState()
- func (d *Daemon) SendStates()
- func (d *Daemon) SharedMount(rafs *rafs.Rafs) error
- func (d *Daemon) SharedUmount(rafs *rafs.Rafs) error
- func (d *Daemon) Start() error
- func (d *Daemon) State() types.DaemonState
- func (d *Daemon) TakeOver() error
- func (d *Daemon) Terminate() error
- func (d *Daemon) UmountRafsInstance(r *rafs.Rafs) error
- func (d *Daemon) UmountRafsInstances() error
- func (d *Daemon) Unlock()
- func (d *Daemon) Wait() error
- func (d *Daemon) WaitUntilState(expected types.DaemonState) error
- type NewDaemonOpt
- func WithConfigDir(dir string) NewDaemonOpt
- func WithDaemonMode(daemonMode config.DaemonMode) NewDaemonOpt
- func WithFsDriver(fsDriver string) NewDaemonOpt
- func WithLogDir(dir string) NewDaemonOpt
- func WithLogLevel(logLevel string) NewDaemonOpt
- func WithLogRotationSize(logRotationSize int) NewDaemonOpt
- func WithLogToStdout(logToStdout bool) NewDaemonOpt
- func WithMountpoint(mountpoint string) NewDaemonOpt
- func WithNydusdThreadNum(nydusdThreadNum int) NewDaemonOpt
- func WithRef(ref int32) NewDaemonOpt
- func WithSocketDir(dir string) NewDaemonOpt
- type NydusdClient
Constants ¶
const ( APISocketFileName = "api.sock" = "shared_daemon" )
Functions ¶
func WaitUntilSocketExisted ¶
Types ¶
type ConfigState ¶
type ConfigState struct { // A unique ID generated by daemon manager to identify the nydusd instance. ID string ProcessID int APISocket string DaemonMode config.DaemonMode FsDriver string LogDir string LogLevel string LogRotationSize int LogToStdout bool Mountpoint string SupervisorPath string ThreadNum int // Where the configuration file resides, all rafs instances share the same configuration template ConfigDir string }
Fields in this structure should be write-once, and caller should hold `Daemon.mu` when updating fields.
type Daemon ¶
type Daemon struct { States ConfigState // Host all RAFS filesystems managed by this daemon: // fusedev dedicated mode: one and only one RAFS instance // fusedev shared mode: zero, one or more RAFS instances // fscache shared mode: zero, one or more RAFS instances RafsCache rafs.Cache // Nil means this daemon object has no supervisor Supervisor *supervisor.Supervisor Config daemonconfig.DaemonConfig // How much CPU nydusd is utilizing when starts since full prefetch might // consume many CPU cycles StartupCPUUtilization float64 Version types.BuildTimeInfo // contains filtered or unexported fields }
TODO: Record queried nydusd state
func NewDaemon ¶
func NewDaemon(opt ...NewDaemonOpt) (*Daemon, error)
Instantiate a daemon object
func (*Daemon) AddRafsInstance ¶
func (*Daemon) ClearVestige ¶
func (d *Daemon) ClearVestige()
When daemon dies, clean up its vestige before start a new one.
func (*Daemon) CloneRafsInstances ¶
func (*Daemon) ConfigFile ¶
Each nydusd daemon has a copy of configuration json file.
func (*Daemon) DecRef ¶
func (*Daemon) Exit ¶
func (*Daemon) GetAPISock ¶
func (*Daemon) GetCacheMetrics ¶
func (d *Daemon) GetCacheMetrics(sid string) (*types.CacheMetrics, error)
func (*Daemon) GetClient ¶
func (d *Daemon) GetClient() (NydusdClient, error)
func (*Daemon) GetDaemonInfo ¶
func (d *Daemon) GetDaemonInfo() (*types.DaemonInfo, error)
func (*Daemon) GetFsMetrics ¶
func (*Daemon) GetInflightMetrics ¶
func (d *Daemon) GetInflightMetrics() (*types.InflightMetrics, error)
func (*Daemon) GetRef ¶
func (*Daemon) GetState ¶
func (d *Daemon) GetState() (types.DaemonState, error)
Get and cache daemon current working state by querying nydusd: 1. INIT 2. READY: All needed resources are ready. 3. RUNNING
func (*Daemon) HostMountpoint ¶
func (*Daemon) ID ¶
func (*Daemon) IncRef ¶
func (d *Daemon) IncRef()
func (*Daemon) IsSharedDaemon ¶
func (*Daemon) Lock ¶
func (d *Daemon) Lock()
func (*Daemon) LogFile ¶
func (*Daemon) NydusdThreadNum ¶
NydusdThreadNum returns how many working threads are needed of a single nydusd
func (*Daemon) Pid ¶
func (*Daemon) RecoverRafsInstances ¶
Daemon must be started and reach RUNNING state before call this method
func (*Daemon) RemoveRafsInstance ¶
func (*Daemon) ResetClient ¶
func (d *Daemon) ResetClient()
func (*Daemon) ResetState ¶
func (d *Daemon) ResetState()
Reset the cached nydusd working status
func (*Daemon) SendStates ¶
func (d *Daemon) SendStates()
func (*Daemon) SharedMount ¶
func (*Daemon) SharedUmount ¶
func (*Daemon) Start ¶
func (*Daemon) State ¶
func (d *Daemon) State() types.DaemonState
Return the cached nydusd working status, no API is invoked.
func (*Daemon) TakeOver ¶
func (*Daemon) Terminate ¶
func (*Daemon) UmountRafsInstance ¶
func (*Daemon) UmountRafsInstances ¶
func (*Daemon) Unlock ¶
func (d *Daemon) Unlock()
func (*Daemon) Wait ¶
func (*Daemon) WaitUntilState ¶
func (d *Daemon) WaitUntilState(expected types.DaemonState) error
Wait for the nydusd daemon to reach specified state with timeout.
type NewDaemonOpt ¶
func WithConfigDir ¶
func WithConfigDir(dir string) NewDaemonOpt
func WithDaemonMode ¶
func WithDaemonMode(daemonMode config.DaemonMode) NewDaemonOpt
func WithFsDriver ¶
func WithFsDriver(fsDriver string) NewDaemonOpt
func WithLogDir ¶
func WithLogDir(dir string) NewDaemonOpt
func WithLogLevel ¶
func WithLogLevel(logLevel string) NewDaemonOpt
func WithLogRotationSize ¶
func WithLogRotationSize(logRotationSize int) NewDaemonOpt
func WithLogToStdout ¶
func WithLogToStdout(logToStdout bool) NewDaemonOpt
func WithMountpoint ¶
func WithMountpoint(mountpoint string) NewDaemonOpt
func WithNydusdThreadNum ¶
func WithNydusdThreadNum(nydusdThreadNum int) NewDaemonOpt
func WithRef ¶
func WithRef(ref int32) NewDaemonOpt
func WithSocketDir ¶
func WithSocketDir(dir string) NewDaemonOpt
Build runtime nydusd daemon object, which might be persisted later
type NydusdClient ¶
type NydusdClient interface { GetDaemonInfo() (*types.DaemonInfo, error) Mount(mountpoint, bootstrap, daemonConfig string) error Umount(mountpoint string) error BindBlob(daemonConfig string) error UnbindBlob(domainID, blobID string) error GetFsMetrics(sid string) (*types.FsMetrics, error) GetInflightMetrics() (*types.InflightMetrics, error) GetCacheMetrics(sid string) (*types.CacheMetrics, error) TakeOver() error SendFd() error Start() error Exit() error }
Nydusd HTTP client to query nydusd runtime status, operate file system instances. Control nydusd workflow like failover and upgrade.
func NewNydusClient ¶
func NewNydusClient(sock string) (NydusdClient, error)
Source Files ¶
client.go config.go daemon.go idgen.go
Directories ¶
Path | Synopsis |
---|---|
pkg/daemon/command | |
pkg/daemon/types |
- Version
- v0.15.1 (latest)
- Published
- Jan 26, 2025
- Platform
- linux/amd64
- Imports
- 31 packages
- Last checked
- 1 week ago –
Tools for package owners.