Documentation
¶
Index ¶
- Constants
- type Cache
- func (rs *Cache) Add(r *Rafs)
- func (rs *Cache) Get(snapshotID string) *Rafs
- func (rs *Cache) Head() *Rafs
- func (rs *Cache) Len() int
- func (rs *Cache) List() map[string]*Rafs
- func (rs *Cache) ListLocked() map[string]*Rafs
- func (rs *Cache) Lock()
- func (rs *Cache) Remove(snapshotID string)
- func (rs *Cache) SetIntances(instances map[string]*Rafs)
- func (rs *Cache) Unlock()
- type NewRafsOpt
- type Rafs
- func (r *Rafs) AddAnnotation(k, v string)
- func (r *Rafs) BootstrapFile() (string, error)
- func (r *Rafs) FscacheWorkDir() string
- func (r *Rafs) GetFsDriver() string
- func (r *Rafs) GetMountpoint() string
- func (r *Rafs) GetSnapshotDir() string
- func (r *Rafs) GetSourceSnapshotID() string
- func (r *Rafs) RelaMountpoint() string
- func (r *Rafs) SetMountpoint(mp string)
- func (r *Rafs) UpdateUnderlyingFiles(files []string, daemonCache *Cache)
Constants ¶
const ( AnnoFsCacheDomainID string = "fscache.domainid" AnnoFsCacheID string = "fscache.id" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
var RafsGlobalCache Cache
Global cache to hold all RAFS instances.
func NewRafsCache ¶
func NewRafsCache() Cache
func (*Cache) ListLocked ¶
func (*Cache) SetIntances ¶
type NewRafsOpt ¶
type Rafs ¶
type Rafs struct {
Seq uint64
ImageID string // Usually is the image reference
DaemonID string
FsDriver string
SnapshotID string // Given by containerd
SnapshotDir string
SourceSnapshotID string
UnderlyingFiles []string // Underlying cache blob files
// 1. A host kernel EROFS/TARFS mountpoint
// 2. Absolute path to each rafs instance root directory.
Mountpoint string
Annotations map[string]string
}
The whole struct will be persisted
func (*Rafs) AddAnnotation ¶
func (*Rafs) BootstrapFile ¶
func (*Rafs) FscacheWorkDir ¶
Blob caches' chunk bitmap and meta headers are stored here.
func (*Rafs) GetFsDriver ¶
func (*Rafs) GetMountpoint ¶
Get top level mount point for the RAFS instance:
- FUSE with dedicated mode: the FUSE filesystem mount point, the RAFS filesystem is directly mounted at the mount point.
- FUSE with shared mode: the FUSE filesystem mount point, the RAFS filesystem is mounted at a subdirectory under the mount point.
- EROFS/fscache: the EROFS filesystem mount point.
func (*Rafs) GetSnapshotDir ¶
func (*Rafs) GetSourceSnapshotID ¶ added in v0.15.16
func (*Rafs) RelaMountpoint ¶
Get the sub-directory under a FUSE mount point to mount a RAFS instance. For a nydusd daemon in shared mode, one or more RAFS filesystem instances can be mounted to sub-directories of the FUSE filesystem. This method returns the subdirectory for a RAFS filesystem instance.
func (*Rafs) SetMountpoint ¶
func (*Rafs) UpdateUnderlyingFiles ¶ added in v0.15.16
UpdateUnderlyingFiles replaces r.UnderlyingFiles while holding both the global RAFS cache lock and, when given, the owning daemon's cache lock.
The same *Rafs is registered in RafsGlobalCache and in the daemon's RafsCache, and each cache's List() deep-copies the instance — reading every field — under that cache's own mutex. A writer that takes only one of the two locks therefore still races with the other cache's readers. The global lock is acquired first; no other code path nests the two locks in the opposite order.