daemon

package
v0.0.0-...-5d6293b Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: GPL-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// only public so they can be referenced by tests
	InitOpSize = 8
	MaxOpSize  = 128 // must be ≤ manifester.ChunkDiffMaxDigests
	MaxDiffOps = 8
	MaxSources = 3
)
View Source
const (
	/*
	 * Fscache ensures that the maximum length of cookie key is 255. The volume key
	 * is controlled by netfs, and generally no bigger than 255.
	 */
	CACHEFILES_MSG_MAX_SIZE = 1024

	CACHEFILES_OP_OPEN  = 0
	CACHEFILES_OP_CLOSE = 1
	CACHEFILES_OP_READ  = 2

	CACHEFILES_IOC_READ_COMPLETE = _IOC_WRITE<<_IOC_DIRSHIFT | 0x98<<_IOC_TYPESHIFT | 1<<_IOC_NRSHIFT | 4<<_IOC_SIZESHIFT
)

Variables

View Source
var (
	// protocol is json over http over unix socket
	// socket is path.Join(CachePath, Socket)
	// accessible to root only!
	Socket          = "styx.sock"
	InitPath        = "/init"
	MountPath       = "/mount"
	UmountPath      = "/umount"
	MaterializePath = "/materialize"
	VaporizePath    = "/vaporize"
	PrefetchPath    = "/prefetch"
	GcPath          = "/gc"
	DebugPath       = "/debug"
	RepairPath      = "/repair"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	DevPath     string
	CachePath   string
	CacheTag    string
	CacheDomain string

	ErofsBlockShift int

	Workers int

	IsTesting bool
	FdStore   systemd.FdStore
}

type DebugChunkInfo

type DebugChunkInfo struct {
	Slab       uint16
	Addr       uint32
	StorePaths []string
	Present    bool
}

type DebugImage

type DebugImage struct {
	Image    *pb.DbImage
	Manifest *pb.Manifest
	Stats    DebugSizeStats
}

type DebugReq

type DebugReq struct {
	IncludeAllImages bool     `json:",omitempty"`
	IncludeImages    []string `json:",omitempty"` // list of base32 sph

	IncludeSlabs  bool `json:",omitempty"`
	IncludeChunks bool `json:",omitempty"`
}

type DebugResp

type DebugResp struct {
	Params  *pb.DbParams
	Stats   Stats
	DbStats bbolt.Stats
	Images  map[string]DebugImage      `json:",omitempty"`
	Slabs   []*DebugSlabInfo           `json:",omitempty"`
	Chunks  map[string]*DebugChunkInfo `json:",omitempty"`
}

type DebugSizeStats

type DebugSizeStats struct {
	TotalChunks   int
	TotalBlocks   int
	PresentChunks int
	PresentBlocks int
}

type DebugSlabInfo

type DebugSlabInfo struct {
	Index         uint16
	Stats         DebugSizeStats
	ChunkSizeDist map[uint32]int
}

type GcReq

type GcReq struct {
}

type InitReq

type InitReq struct {
	PubKeys []string
	Params  pb.DaemonParams
}

type MaterializeReq

type MaterializeReq struct {
	Upstream  string
	StorePath string
	DestPath  string
	NarSize   int64 `json:",omitempty"` // optional
}

type MountReq

type MountReq struct {
	Upstream   string
	StorePath  string
	MountPoint string
	NarSize    int64 `json:",omitempty"` // optional
}

type PrefetchReq

type PrefetchReq struct {
	// absolute path of file or directory to prefetch (unless using StorePath)
	Path string
	// optional, if set use this StorePath and consider Path under it
	StorePath string
}

type RepairReq

type RepairReq struct {
	Presence   bool      `json:",omitempty"`
	Remanifest *MountReq `json:",omitempty"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg Config) *Server

func (*Server) AllocateBatch

func (s *Server) AllocateBatch(ctx context.Context, blocks []uint16, digests []cdig.CDig) ([]erofs.SlabLoc, error)

func (*Server) SlabInfo

func (s *Server) SlabInfo(slabId uint16) (tag string, totalBlocks uint32)

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop(closeDevnode bool)

this is only for tests! the real daemon doesn't clean up, since we can't restore the cache state, it dies and lets systemd keep the devnode open.

func (*Server) VerifyParams

func (s *Server) VerifyParams(blockShift common.BlkShift) error

type Sph

func ParseSph

func ParseSph(s string) (sph Sph, sphStr string, err error)

func SphFromBytes

func SphFromBytes(b []byte) (sph Sph)

func (Sph) String

func (s Sph) String() string

type SphPrefix

type SphPrefix [sphPrefixBytes]byte

func SphPrefixFromBytes

func SphPrefixFromBytes(b []byte) (sphp SphPrefix)

type Stats

type Stats struct {
	ManifestCacheReqs int64 // total manifest cache requests
	ManifestCacheHits int64 // requests that got a hit
	ManifestReqs      int64 // requests for new manifest
	ManifestErrs      int64 // requests for new manifest that got an error
	SlabReads         int64 // read requests to slab
	SlabReadErrs      int64 // failed read requests to slab
	SingleReqs        int64 // chunk request count
	SingleBytes       int64 // chunk bytes received (uncompressed)
	SingleErrs        int64 // chunk request error count
	BatchReqs         int64 // no-base diff request count
	BatchBytes        int64 // no-base diff bytes received (compressed)
	BatchErrs         int64 // no-base diff request error count
	DiffReqs          int64 // with-base diff request count
	DiffBytes         int64 // with-base diff bytes received (compressed)
	DiffErrs          int64 // with-base diff request error count
	RecompressReqs    int64 // reqs with recompression
	ExtraReqs         int64 // extra read-ahead reqs (beyond 1 per read)
}

type Status

type Status struct {
	Success bool   `json:",omitempty"`
	Error   string `json:",omitempty"`
}

type UmountReq

type UmountReq struct {
	StorePath string
}

type VaporizeReq

type VaporizeReq struct {
	Path string // absolute path to data to vaporize into store (required)
	Name string // store path name, defaults to basename of Path
}

Jump to

Keyboard shortcuts

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