Documentation
¶
Index ¶
- Constants
- Variables
- func WaitUntilSocketExisted(sock string) error
- type Daemon
- func (d *Daemon) AddInstance(r *Rafs)
- func (d *Daemon) ClearVestige()
- func (d *Daemon) CloneInstances(src *Daemon) error
- 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) GetFsMetrics(sid string) (*types.FsMetrics, 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) Lock()
- func (d *Daemon) LogFile() string
- func (d *Daemon) NydusdThreadNum() int
- func (d *Daemon) Pid() int
- func (d *Daemon) RecoveredMountInstances() error
- func (d *Daemon) RemoveInstance(snapshotID string)
- func (d *Daemon) ResetClient()
- func (d *Daemon) SendStates() error
- func (d *Daemon) SharedMount(rafs *Rafs) error
- func (d *Daemon) SharedUmount(rafs *Rafs) error
- func (d *Daemon) Start() error
- func (d *Daemon) TakeOver() error
- func (d *Daemon) Terminate() error
- func (d *Daemon) UmountAllInstances() error
- func (d *Daemon) UmountInstance(r *Rafs) 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 WithFsDriver(fsDriver string) NewDaemonOpt
- func WithLogDir(dir string) NewDaemonOpt
- func WithLogLevel(logLevel string) 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 NewRafsOpt
- type NydusdClient
- type Rafs
- type States
Constants ¶
const ( APISocketFileName = "api.sock" )
const (
AnnoFsCacheDomainID string = "fscache.domainid"
)
Variables ¶
var RafsSet rafsSet
Functions ¶
func WaitUntilSocketExisted ¶ added in v0.4.0
Types ¶
type Daemon ¶
type Daemon struct {
States States
// FsInstances map[int]*Rafs
// should be persisted to DB
// maps to at least one rafs instance.
// It is possible to be empty after the daemon object is created.
Instances rafsSet
// Nil means this daemon object has no supervisor
Supervisor *supervisor.Supervisor
Config daemonconfig.DaemonConfig
// Cache the nydusd daemon state to avoid frequently querying nydusd by API.
State types.DaemonState
// contains filtered or unexported fields
}
TODO: Record queried nydusd state
func (*Daemon) AddInstance ¶ added in v0.4.0
func (*Daemon) ClearVestige ¶ added in v0.3.0
func (d *Daemon) ClearVestige()
When daemon dies, clean up its vestige before start a new one.
func (*Daemon) CloneInstances ¶ added in v0.4.0
func (*Daemon) ConfigFile ¶
Each nydusd daemon has a copy of configuration json file.
func (*Daemon) GetAPISock ¶ added in v0.2.1
func (*Daemon) GetCacheMetrics ¶ added in v0.4.0
func (d *Daemon) GetCacheMetrics(sid string) (*types.CacheMetrics, error)
func (*Daemon) GetClient ¶ added in v0.4.0
func (d *Daemon) GetClient() (NydusdClient, error)
func (*Daemon) GetFsMetrics ¶ added in v0.4.0
func (*Daemon) GetState ¶ added in v0.4.0
func (d *Daemon) GetState() (types.DaemonState, error)
Nydusd daemon current working state by requesting to nydusd: 1. INIT 2. READY: All needed resources are ready. 3. RUNNING
func (*Daemon) HostMountpoint ¶ added in v0.4.0
func (*Daemon) NydusdThreadNum ¶
NydusdThreadNum returns how many working threads are needed of a single nydusd
func (*Daemon) RecoveredMountInstances ¶ added in v0.4.0
Daemon must be started and reach RUNNING state before call this method
func (*Daemon) RemoveInstance ¶ added in v0.4.0
func (*Daemon) ResetClient ¶ added in v0.3.0
func (d *Daemon) ResetClient()
func (*Daemon) SendStates ¶ added in v0.4.0
func (*Daemon) SharedMount ¶
func (*Daemon) SharedUmount ¶
func (*Daemon) UmountAllInstances ¶ added in v0.4.0
func (*Daemon) UmountInstance ¶ added in v0.4.0
func (*Daemon) WaitUntilState ¶ added in v0.4.0
func (d *Daemon) WaitUntilState(expected types.DaemonState) error
Waits for some time until daemon reaches the expected state. For example:
- INIT
- READY
- RUNNING
type NewDaemonOpt ¶
func WithConfigDir ¶
func WithConfigDir(dir string) NewDaemonOpt
func WithFsDriver ¶ added in v0.3.0
func WithFsDriver(fsDriver string) NewDaemonOpt
func WithLogDir ¶
func WithLogDir(dir string) NewDaemonOpt
func WithLogLevel ¶
func WithLogLevel(logLevel string) NewDaemonOpt
func WithLogToStdout ¶
func WithLogToStdout(logToStdout bool) NewDaemonOpt
func WithMountpoint ¶ added in v0.4.0
func WithMountpoint(mountpoint string) NewDaemonOpt
func WithNydusdThreadNum ¶
func WithNydusdThreadNum(nydusdThreadNum int) NewDaemonOpt
func WithRef ¶ added in v0.4.0
func WithRef(ref int32) NewDaemonOpt
func WithSocketDir ¶
func WithSocketDir(dir string) NewDaemonOpt
Build runtime nydusd daemon object, which might be persisted later
type NewRafsOpt ¶ added in v0.4.0
type NydusdClient ¶ added in v0.4.0
type NydusdClient interface {
GetDaemonInfo() (*types.DaemonInfo, error)
Mount(mountpoint, bootstrap, daemonConfig string) error
Umount(mountpoint string) error
BindBlob(daemonConfig string) error
UnbindBlob(daemonConfig string) error
GetFsMetrics(sid string) (*types.FsMetrics, 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 ¶ added in v0.4.0
func NewNydusClient(sock string) (NydusdClient, error)
type Rafs ¶ added in v0.4.0
type Rafs struct {
Seq uint64
// Given by containerd
SnapshotID string
// Usually is the image reference
ImageID string
DaemonID string
SnapshotDir string
// A host kernel EROFS mountpoint
// Absolute path to each rafs instance root directory.
Mountpoint string
Annotations map[string]string
}
The whole struct will be persisted
func (*Rafs) AddAnnotation ¶ added in v0.4.0
func (*Rafs) BootstrapFile ¶ added in v0.4.0
func (*Rafs) FscacheWorkDir ¶ added in v0.4.0
Blob caches' chunk bitmap and meta headers are stored here.
func (*Rafs) GetMountpoint ¶ added in v0.4.0
Mountpoint of per-image nydusd/rafs. It is a kernel mountpoint for each nydus meta layer. Each meta layer is associated with a nydusd.
func (*Rafs) GetSnapshotDir ¶ added in v0.4.0
func (*Rafs) RelaMountpoint ¶ added in v0.4.0
Mountpoint for nydusd within single kernel mountpoint(FUSE mount). Each mountpoint is create by API based pseudo mount. `RootMountPoint` is real mountpoint where to perform the kernel mount. Nydusd API based mountpoint must start with "/", otherwise nydusd API server returns error.
func (*Rafs) SetMountpoint ¶ added in v0.4.0
type States ¶ added in v0.4.0
type States struct {
// Generated by daemons manager as a unique to identify a nydusd
ID string
ProcessID int
APISocket string
LogDir string
LogLevel string
LogToStdout bool
FsDriver string
// Host kernel mountpoint, only applies to fuse fs driver. The fscache fs driver
// doesn't need a host kernel mountpoint.
Mountpoint string
ThreadNum int
// Where the configuration file resides, all rafs instances share the same configuration template
ConfigDir string
SupervisorPath string
}