Documentation
¶
Overview ¶
Package sessionmount mounts a session's uploads and memory stores as file systems for bmaexecutor.SessionFiles (capabilities.session_files.mount, ADR-0111). It runs inside a root executor on Linux (go-fuse, direct mount(2), no fusermount): every mount is answered by this process, reads content through the session's anchor (bmaexecutor.SessionSource) and caches it by sha256. On other systems New fails and the executor copies.
Index ¶
Constants ¶
const ( // ChunkBytes is the range a large file is fetched in. ChunkBytes = 8 << 20 // DefaultCacheBytes bounds the cache. DefaultCacheBytes = 2 << 30 // FetchTimeout bounds fetching one range (or one small file). FetchTimeout = 30 * time.Second )
Content of mounted uploads is cached on the machine's disk by sha256 (ADR-0111): a file of at most ChunkBytes is fetched whole and checked before its first byte is returned; a larger one is fetched in ChunkBytes ranges as it is read and checked once every range is there. A file whose bytes do not match its digest is removed and every read of it fails. Objects nobody has open are evicted oldest first when the cache would exceed its limit. The cache is emptied when it is created: content is only trusted once this process checked it.
const FSName = "bma-session"
FSName is the file system type of the mounts ("fuse." + FSName in /proc/mounts).
Variables ¶
var ErrDigest = errors.New("sessionmount: content does not match its digest")
ErrDigest reports content whose bytes are not its digest.
var ErrUnsupported = errors.New("sessionmount: mounting session files needs Linux")
ErrUnsupported: session files are mounted on Linux only; elsewhere New and Probe answer it and the executor copies.
Functions ¶
func DetachStale ¶
DetachStale detaches every mount of this package below root (left by an executor that ended without unmounting).
Types ¶
type Mounter ¶
type Mounter struct {
// contains filtered or unexported fields
}
Mounter keeps the mounts of every session of this executor.
func (*Mounter) Mount ¶
func (m *Mounter) Mount(_ context.Context, s bmaexecutor.SessionMount) error
Mount implements bmaexecutor.SessionMounter.
func (*Mounter) Stats ¶
func (m *Mounter) Stats() bmaexecutor.SessionFilesStats
Stats implements bmaexecutor.SessionMounter.