filesystem

package
v0.1.23-oss Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const ClientThrottleLevel = 10

When to start throttling client goroutines

View Source
const MaxConcurrentOps = 8000

The default value for maximum number of os-threads in golang is 10000. We save 2000 for other potential concurrent sys-calls, and leave 8000 for abfs interactions.

Variables

This section is empty.

Functions

func IsGitPath

func IsGitPath(p string) bool

func IsMatchError

func IsMatchError(err error) bool

func ProjectGitConfig

func ProjectGitConfig(info ProjectInfo) ([]byte, error)

func WriteFile

func WriteFile(ctx context.Context, root bindcas.Dir, name string, reader io.Reader) (returnErr error)

func WriteJson

func WriteJson(w http.ResponseWriter, r interface{})

Types

type AddDigestMapEntriesInput

type AddDigestMapEntriesInput struct {
	Entries []binding.DigestEntry `json:"entries"`
}

type BackendStatDTO

type BackendStatDTO struct {
	IsARI bool        `json:"isARI"`
	ARI   string      `json:"ari"`
	Hash  string      `json:"hash"`
	Mode  fs.FileMode `json:"mode"`
	Size  int64       `json:"size"`
}

type CasfsMount

type CasfsMount struct {
	MountInfo
	// contains filtered or unexported fields
}

Provide Mount via cas filesystem

func NewCasfsMount

func NewCasfsMount(osMounter OsMounter) *CasfsMount

func (*CasfsMount) AddDigestMapEntries

func (m *CasfsMount) AddDigestMapEntries(entries []binding.DigestEntry)

func (*CasfsMount) AddEntry

func (m *CasfsMount) AddEntry(ctx context.Context, name string, mode entities.FileMode, hash entities.Hash, size int64) error

func (*CasfsMount) BackendStatToRBE

func (m *CasfsMount) BackendStatToRBE(ctx context.Context, p string, bStat bindcas.CASBackendStat) (*RBEPathStat, error)

func (*CasfsMount) CASFS

func (m *CasfsMount) CASFS() bindcas.CASFS

func (*CasfsMount) Chroot

func (m *CasfsMount) Chroot(ctx context.Context, p string) (bindcas.Dir, error)

func (*CasfsMount) Config

func (m *CasfsMount) Config() *entities.FSConfig

func (*CasfsMount) CreateDir

func (m *CasfsMount) CreateDir(path string) bindcas.Dir

func (*CasfsMount) CreateFile

func (m *CasfsMount) CreateFile(ctx context.Context, name string, mode entities.FileMode, hash entities.Hash, size int64, exists bool) error

func (*CasfsMount) GetRBEDigest

func (m *CasfsMount) GetRBEDigest(ctx context.Context, p string) (*RBEPathStat, error)

func (*CasfsMount) GetRBEDigests

func (m *CasfsMount) GetRBEDigests(ctx context.Context, goCount int64, paths []string) ([]RBEPathStat, map[string]string)

func (*CasfsMount) GetRBETapDigest

func (m *CasfsMount) GetRBETapDigest(ctx context.Context, goCount int64, input RBETapDigestInput) (*RBETapDigestResponse, error)

func (*CasfsMount) HashStats

func (m *CasfsMount) HashStats(ctx context.Context, goCount int64, prefix string, paths []string) ([]entities.HashStat, map[string]string)

func (*CasfsMount) Hashes

func (m *CasfsMount) Hashes(ctx context.Context, goCount int64, prefix string, paths []string) ([]string, map[string]string)

func (*CasfsMount) LoadTreeDigestMap

func (m *CasfsMount) LoadTreeDigestMap(ctx context.Context, tree entities.Hash) error

func (*CasfsMount) MatchAndPatch

func (m *CasfsMount) MatchAndPatch(ctx context.Context, goCount int64, chroot string, readPatch, writePatch entities.Patch, deletes entities.DeletePatch) error

func (*CasfsMount) Matches

func (m *CasfsMount) Matches(ctx context.Context, goCount int64, chroot string, patch entities.Patch) error

func (*CasfsMount) Mount

func (m *CasfsMount) Mount(ctx context.Context, mountPoint string, mntInfo MountInfo, store entities.CASStore) error

func (*CasfsMount) NewGitDir

func (m *CasfsMount) NewGitDir(ctx context.Context, root, dir bindcas.Dir, info ProjectInfo) error

func (*CasfsMount) NewRepoObjDir

func (m *CasfsMount) NewRepoObjDir(ctx context.Context, root, dir bindcas.Dir, name string, info ProjectInfo) error

func (*CasfsMount) Ready

func (m *CasfsMount) Ready()

func (*CasfsMount) Root

func (m *CasfsMount) Root() bindcas.Dir

func (*CasfsMount) Serve

func (m *CasfsMount) Serve() error

func (*CasfsMount) SetInitConfig

func (m *CasfsMount) SetInitConfig(c *entities.FSConfig)

func (*CasfsMount) SetRBEDigest

func (m *CasfsMount) SetRBEDigest(ctx context.Context, p string, digest rbemodel.Digest, mode uint32) error

func (*CasfsMount) SetRBEDigests

func (m *CasfsMount) SetRBEDigests(ctx context.Context, goCount int64, items []RBEPathStat) map[string]string

func (*CasfsMount) Unmount

func (m *CasfsMount) Unmount()

type Daemon

type Daemon interface {
	Run(ctx context.Context) error
}

type GetRBEDigestInput

type GetRBEDigestInput struct {
	Path string `json:"path"`
}

type GetRBEDigestsInput

type GetRBEDigestsInput struct {
	Paths []string `json:"paths"`
}

type HTTP

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

HTTP interface to mounts (abfs/casfs)

func CreateHTTP

func CreateHTTP(mnt HTTPMount, store entities.CASStore) *HTTP

func (*HTTP) CreateRouter

func (a *HTTP) CreateRouter(prefix string) *mux.Router

type HTTPMount

type HTTPMount interface {
	// Hashes find the hash of a list of paths. Unknown paths will return the empty
	// file hash instead of an error.
	Hashes(ctx context.Context, goCnt int64, prefix string, paths []string) (result []string, errs map[string]string)
	// HashStats find the hash, size, and file mode of a list of paths. Unknown paths will return the empty
	// file hash instead of an error.
	HashStats(ctx context.Context, goCnt int64, prefix string, paths []string) (result []entities.HashStat, errs map[string]string)
	Matches(ctx context.Context, goCnt int64, path string, patch entities.Patch) error
	MatchAndPatch(ctx context.Context, goCnt int64, path string, readPatch, writePatch entities.Patch, deletes entities.DeletePatch) error
	NewGitDir(ctx context.Context, root, dir bindcas.Dir, info ProjectInfo) error
	NewRepoObjDir(ctx context.Context, root, dir bindcas.Dir, name string, info ProjectInfo) error
	Root() bindcas.Dir
	SetRBEDigest(ctx context.Context, path string, digest rbemodel.Digest, mode uint32) error
	GetRBEDigest(ctx context.Context, path string) (*RBEPathStat, error)
	SetRBEDigests(ctx context.Context, goCount int64, digests []RBEPathStat) (errs map[string]string)
	GetRBEDigests(ctx context.Context, goCount int64, paths []string) (result []RBEPathStat, errs map[string]string)
	GetRBETapDigest(ctx context.Context, goCount int64, input RBETapDigestInput) (*RBETapDigestResponse, error)
	LoadTreeDigestMap(ctx context.Context, tree entities.Hash) error
	AddDigestMapEntries(entries []binding.DigestEntry)
}

type LoadTreeDigestMapInput

type LoadTreeDigestMapInput struct {
	Tree string `json:"tree"`
}

type MatchError

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

func NewMatchError

func NewMatchError(format string, args ...any) *MatchError

func (*MatchError) Error

func (e *MatchError) Error() string

type MatchInput

type MatchInput struct {
	Hash string
	Path string
}

type Mount

type Mount interface {
	HTTPMount

	SetInitConfig(c *entities.FSConfig)
	Config() *entities.FSConfig
	Mount(ctx context.Context, mountPoint string, mntInfo MountInfo, store entities.CASStore) error
	Unmount()
	Chroot(ctx context.Context, path string) (bindcas.Dir, error)
	Serve() error
	Ready()
	CASFS() bindcas.CASFS
	CreateDir(path string) bindcas.Dir
}

type MountInfo

type MountInfo struct {
	CacheDir       string
	LocalOnly      bool
	FetchTimeout   time.Duration
	PartialClone   bool
	RemoteReadOnly bool
}

type OsMounter

type OsMounter interface {
	DoMount(path string, m *MountInfo, cfg *entities.FSConfig, casStore entities.CASStore) (bindcas.CASFS, error)
	DoUnmount(path string) error
	DoServe() error
}

type PatchInput

type PatchInput struct {
	Match   entities.Patch
	Patch   entities.Patch
	Deletes entities.DeletePatch
	Path    string
}

type ProjectInfo

type ProjectInfo struct {
	Commit       *object.Commit
	Git          *casgit.CASGit
	Project      *manifest.Project
	Server       string
	Manifest     *manifest.Manifest
	Packs        *binding.PackFiles
	PartialClone bool

	// Needed to resolve "fetch" URLs.
	SchemeManProjURL string
}

type RBEPathStat

type RBEPathStat struct {
	Path string `json:"path"`
	rbemodel.Digest
	Mode uint32 `json:"mode,omitempty"`
}

type RBETapDigestInput

type RBETapDigestInput struct {
	Reads  map[string]bindcas.CASBackendStat `json:"reads"`
	Writes map[string]bindcas.CASBackendStat `json:"writes"`
}

func (RBETapDigestInput) MarshalJSON

func (input RBETapDigestInput) MarshalJSON() ([]byte, error)

MarshalJSON serializes RBETapDigestInput for client HTTP requests (e.g., in cmd/rbetap).

func (*RBETapDigestInput) UnmarshalJSON

func (input *RBETapDigestInput) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes RBETapDigestInput for server HTTP handlers (e.g., in handleGetRBETapDigest).

type RBETapDigestResponse

type RBETapDigestResponse struct {
	Reads  []RBEPathStat `json:"reads"`
	Writes []RBEPathStat `json:"writes"`
}

type SetRBEDigestsInput

type SetRBEDigestsInput struct {
	Digests []RBEPathStat `json:"digests"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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