daemonconfig

package
v0.13.12 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const (
	WorkDir   string = "workdir"
	Bootstrap string = "bootstrap"
)
View Source
const CacheDir string = "cachedir"

Variables

This section is empty.

Functions

func DumpConfigFile

func DumpConfigFile(c interface{}, path string) error

For nydusd as FUSE daemon. Serialize Daemon info and persist to a json file We don't have to persist configuration file for fscache since its configuration is passed through HTTP API.

func DumpConfigString

func DumpConfigString(c interface{}) (string, error)

func SupplementDaemonConfig

func SupplementDaemonConfig(c DaemonConfig, imageID, snapshotID string,
	vpcRegistry bool, labels map[string]string, params map[string]string) error

Achieve a daemon configuration from template or snapshotter's configuration

Types

type BackendConfig

type BackendConfig struct {
	// Localfs backend configs
	BlobFile     string `json:"blob_file,omitempty"`
	Dir          string `json:"dir,omitempty"`
	ReadAhead    bool   `json:"readahead"`
	ReadAheadSec int    `json:"readahead_sec,omitempty"`

	// Registry backend configs
	Host               string         `json:"host,omitempty"`
	Repo               string         `json:"repo,omitempty"`
	Auth               string         `json:"auth,omitempty" secret:"true"`
	RegistryToken      string         `json:"registry_token,omitempty" secret:"true"`
	BlobURLScheme      string         `json:"blob_url_scheme,omitempty"`
	BlobRedirectedHost string         `json:"blob_redirected_host,omitempty"`
	Mirrors            []MirrorConfig `json:"mirrors,omitempty"`

	// OSS backend configs
	EndPoint        string `json:"endpoint,omitempty"`
	AccessKeyID     string `json:"access_key_id,omitempty" secret:"true"`
	AccessKeySecret string `json:"access_key_secret,omitempty" secret:"true"`
	BucketName      string `json:"bucket_name,omitempty"`
	ObjectPrefix    string `json:"object_prefix,omitempty"`

	// Shared by registry and oss backend
	Scheme     string `json:"scheme,omitempty"`
	SkipVerify bool   `json:"skip_verify,omitempty"`

	// Below configs are common configs shared by all backends
	Proxy struct {
		URL           string `json:"url,omitempty"`
		Fallback      bool   `json:"fallback"`
		PingURL       string `json:"ping_url,omitempty"`
		CheckInterval int    `json:"check_interval,omitempty"`
		UseHTTP       bool   `json:"use_http,omitempty"`
	} `json:"proxy,omitempty"`
	Timeout        int `json:"timeout,omitempty"`
	ConnectTimeout int `json:"connect_timeout,omitempty"`
	RetryLimit     int `json:"retry_limit,omitempty"`
}

type BlobPrefetchConfig

type BlobPrefetchConfig struct {
	Enable        bool `json:"enable"`
	ThreadsCount  int  `json:"threads_count"`
	MergingSize   int  `json:"merging_size"`
	BandwidthRate int  `json:"bandwidth_rate"`
}

type DaemonConfig

type DaemonConfig interface {
	// Provide stuffs relevant to accessing registry apart from auth
	Supplement(host, repo, snapshotID string, params map[string]string)
	// Provide auth
	FillAuth(kc *auth.PassKeyChain)
	StorageBackend() (StorageBackendType, *BackendConfig)
	UpdateMirrors(mirrorsConfigDir, registryHost string) error
	DumpString() (string, error)
	DumpFile(path string) error
}

func NewDaemonConfig

func NewDaemonConfig(fsDriver, path string) (DaemonConfig, error)

Daemon configurations factory

type DeviceConfig

type DeviceConfig struct {
	Backend struct {
		BackendType string        `json:"type"`
		Config      BackendConfig `json:"config"`
	} `json:"backend"`
	Cache struct {
		CacheType  string `json:"type"`
		Compressed bool   `json:"compressed,omitempty"`
		Config     struct {
			WorkDir           string `json:"work_dir"`
			DisableIndexedMap bool   `json:"disable_indexed_map"`
		} `json:"config"`
	} `json:"cache"`
}

type FSPrefetch

type FSPrefetch struct {
	Enable        bool `json:"enable"`
	PrefetchAll   bool `json:"prefetch_all"`
	ThreadsCount  int  `json:"threads_count"`
	MergingSize   int  `json:"merging_size"`
	BandwidthRate int  `json:"bandwidth_rate"`
}

Control how to perform prefetch from file system layer

type FscacheDaemonConfig

type FscacheDaemonConfig struct {
	// These fields is only for fscache daemon.
	Type string `json:"type"`
	// Snapshotter fills
	ID       string `json:"id"`
	DomainID string `json:"domain_id"`
	Config   *struct {
		ID            string        `json:"id"`
		BackendType   string        `json:"backend_type"`
		BackendConfig BackendConfig `json:"backend_config"`
		CacheType     string        `json:"cache_type"`
		// Snapshotter fills
		CacheConfig struct {
			WorkDir string `json:"work_dir"`
		} `json:"cache_config"`
		BlobPrefetchConfig BlobPrefetchConfig `json:"prefetch_config"`
		MetadataPath       string             `json:"metadata_path"`
	} `json:"config"`
}

func LoadFscacheConfig

func LoadFscacheConfig(p string) (*FscacheDaemonConfig, error)

Load Fscache configuration template file

func (*FscacheDaemonConfig) DumpFile

func (c *FscacheDaemonConfig) DumpFile(f string) error

func (*FscacheDaemonConfig) DumpString

func (c *FscacheDaemonConfig) DumpString() (string, error)

func (*FscacheDaemonConfig) FillAuth

func (c *FscacheDaemonConfig) FillAuth(kc *auth.PassKeyChain)

func (*FscacheDaemonConfig) StorageBackend added in v0.8.0

func (c *FscacheDaemonConfig) StorageBackend() (string, *BackendConfig)

func (*FscacheDaemonConfig) Supplement

func (c *FscacheDaemonConfig) Supplement(host, repo, snapshotID string, params map[string]string)

Each fscache/erofs has a configuration with different fscache ID built from snapshot ID.

func (*FscacheDaemonConfig) UpdateMirrors added in v0.6.0

func (c *FscacheDaemonConfig) UpdateMirrors(mirrorsConfigDir, registryHost string) error

type FuseDaemonConfig

type FuseDaemonConfig struct {
	Device          *DeviceConfig `json:"device"`
	Mode            string        `json:"mode"`
	DigestValidate  bool          `json:"digest_validate"`
	IOStatsFiles    bool          `json:"iostats_files,omitempty"`
	EnableXattr     bool          `json:"enable_xattr,omitempty"`
	AccessPattern   bool          `json:"access_pattern,omitempty"`
	LatestReadFiles bool          `json:"latest_read_files,omitempty"`
	AmplifyIo       *int          `json:"amplify_io,omitempty"`
	FSPrefetch      `json:"fs_prefetch,omitempty"`
	// (experimental) The nydus daemon could cache more data to increase hit ratio when enabled the warmup feature.
	Warmup uint64 `json:"warmup,omitempty"`
}

Used when nydusd works as a FUSE daemon or vhost-user-fs backend

func LoadFuseConfig

func LoadFuseConfig(p string) (*FuseDaemonConfig, error)

Load fuse daemon configuration from template file

func (*FuseDaemonConfig) DumpFile

func (c *FuseDaemonConfig) DumpFile(f string) error

func (*FuseDaemonConfig) DumpString

func (c *FuseDaemonConfig) DumpString() (string, error)

func (*FuseDaemonConfig) FillAuth

func (c *FuseDaemonConfig) FillAuth(kc *auth.PassKeyChain)

func (*FuseDaemonConfig) StorageBackend added in v0.8.0

func (c *FuseDaemonConfig) StorageBackend() (string, *BackendConfig)

func (*FuseDaemonConfig) Supplement

func (c *FuseDaemonConfig) Supplement(host, repo, _ string, params map[string]string)

func (*FuseDaemonConfig) UpdateMirrors added in v0.6.0

func (c *FuseDaemonConfig) UpdateMirrors(mirrorsConfigDir, registryHost string) error

type HostFileConfig added in v0.7.0

type HostFileConfig struct {
	Capabilities []string               `toml:"capabilities"`
	CACert       interface{}            `toml:"ca"`
	Client       interface{}            `toml:"client"`
	SkipVerify   *bool                  `toml:"skip_verify"`
	Header       map[string]interface{} `toml:"header"`
	OverridePath bool                   `toml:"override_path"`

	// The following configuration items are specific to nydus.
	HealthCheckInterval int    `toml:"health_check_interval,omitempty"`
	FailureLimit        uint8  `toml:"failure_limit,omitempty"`
	PingURL             string `toml:"ping_url,omitempty"`
}

Copied from containerd, for compatibility with containerd's toml configuration file.

type MirrorConfig

type MirrorConfig struct {
	Host                string            `json:"host,omitempty"`
	Headers             map[string]string `json:"headers,omitempty"`
	HealthCheckInterval int               `json:"health_check_interval,omitempty"`
	FailureLimit        uint8             `json:"failure_limit,omitempty"`
	PingURL             string            `json:"ping_url,omitempty"`
}

func LoadMirrorsConfig added in v0.6.0

func LoadMirrorsConfig(mirrorsConfigDir, registryHost string) ([]MirrorConfig, error)

type StorageBackendType

type StorageBackendType = string

Jump to

Keyboard shortcuts

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