fuse

package
v2.8.0-nightly.20231025 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GETLK is constant for F_OFD_GETLK
	GETLK = 36
	// SETLK is constant for F_OFD_SETLK
	SETLK = 37
	// SETLKW is constant for F_OFD_SETLKW
	SETLKW = 38
)
View Source
const NumDatumsPerPage = 0 // The number of datums requested per ListDatum call

TODO: Get all datums for now (value of 0). Once ListDatum pagination is efficient, specify page size. #ListDatumPagination

View Source
const Separator = string(filepath.Separator)

Variables

This section is empty.

Functions

func Mount

func Mount(c *client.APIClient, project, target string, opts *Options) (retErr error)

Mount pfs to target, opts may be left nil.

TODO: support mounting repos from more than one project.

func NewLoopbackFile

func NewLoopbackFile(fd int) fs.FileHandle

NewLoopbackFile creates a FileHandle out of a file descriptor. All operations are implemented.

func Server

func Server(sopts *ServerOptions, existingClient *client.APIClient) error

Types

type CommitRequest

type CommitRequest struct {
	Mount string `json:"mount"`
}

type ConfigRequest

type ConfigRequest struct {
	PachdAddress string `json:"pachd_address"`
	ServerCas    string `json:"server_cas"`
}

type DatumState added in v2.8.0

type DatumState struct {
	Datums              []*pps.DatumInfo
	PaginationMarker    string
	DatumInput          *pps.Input
	DatumInputsToMounts map[string][]string
	DatumIdx            int
	AllDatumsReceived   bool
}

type DatumsResponse

type DatumsResponse struct {
	NumDatums         int        `json:"num_datums"`
	Input             *pps.Input `json:"input"`
	Idx               int        `json:"idx"`
	AllDatumsReceived bool       `json:"all_datums_received"`
}

type ListMountResponse

type ListMountResponse struct {
	Mounted   []MountState   `json:"mounted"`
	Unmounted []RepoResponse `json:"unmounted"`
}

type ListRepoResponse

type ListRepoResponse []RepoResponse

type MountDatumResponse

type MountDatumResponse struct {
	// We'll return this as empty string until #ListDatumPagination since we don't know the
	// ID for datums we artificially constructed in CreateDatums()
	Id                string `json:"id"`
	Idx               int    `json:"idx"`
	NumDatums         int    `json:"num_datums"`
	AllDatumsReceived bool   `json:"all_datums_received"`
}

type MountInfo

type MountInfo struct {
	Name    string   `json:"name"`
	Project string   `json:"project"`
	Repo    string   `json:"repo"`
	Branch  string   `json:"branch"`
	Commit  string   `json:"commit"` // "" for no commit (commit as noun)
	Paths   []string `json:"paths"`
	Mode    string   `json:"mode"` // "ro", "rw"
}

type MountManager

type MountManager struct {
	Client *client.APIClient
	// only put a value into the States map when we have a goroutine running for
	// it. i.e. when we try to mount it for the first time.
	States map[string]*MountStateMachine
	DatumState

	Cleanup chan struct{}
	// contains filtered or unexported fields
}

func CreateMount

func CreateMount(c *client.APIClient, mountDir string, allowOther bool) (*MountManager, error)

func NewMountManager

func NewMountManager(c *client.APIClient, target string, opts *Options) (ret *MountManager, retErr error)

func (*MountManager) CommitRepo

func (mm *MountManager) CommitRepo(name string) (Response, error)

func (*MountManager) CreateDatums added in v2.8.0

func (mm *MountManager) CreateDatums() error

TODO: For input specs that only have cross, union, or PFS inputs, create datums manually using GlobFile for now because it's faster than ListDatum. Once ListDatum pagination is efficient, we can remove this. #ListDatumPagination

func (*MountManager) FinishAll

func (mm *MountManager) FinishAll() (retErr error)

func (*MountManager) GetDatums added in v2.8.0

func (mm *MountManager) GetDatums(simpleInput bool) (retErr error)

func (*MountManager) GetNextXDatums added in v2.8.0

func (mm *MountManager) GetNextXDatums(numDatums int, paginationMarker string) ([]*pps.DatumInfo, error)

func (*MountManager) ListByMounts

func (mm *MountManager) ListByMounts() (ListMountResponse, error)

func (*MountManager) ListByRepos

func (mm *MountManager) ListByRepos() (ListRepoResponse, error)

func (*MountManager) MaybeStartFsm

func (mm *MountManager) MaybeStartFsm(name string)

func (*MountManager) MountRepo

func (mm *MountManager) MountRepo(mi *MountInfo) (Response, error)

func (*MountManager) Run

func (mm *MountManager) Run() error

func (*MountManager) Start

func (mm *MountManager) Start()

func (*MountManager) UnmountAll

func (mm *MountManager) UnmountAll() error

func (*MountManager) UnmountRepo

func (mm *MountManager) UnmountRepo(name string) (Response, error)

type MountRequest

type MountRequest struct {
	Mounts []*MountInfo `json:"mounts"`
}

type MountState

type MountState struct {
	MountInfo         // mount details. written by client
	State      string `json:"state"`      // "unmounted", "mounting", "mounted", "pushing", "unmounted", "error". written by fsm
	Status     string `json:"status"`     // human readable string with additional info wrt State, e.g. an error message for the error state. written by fsm
	Mountpoint string `json:"mountpoint"` // where on the filesystem it's mounted. written by fsm. can also be derived from {MountDir}/{Name}
	// the following are used by the "refresh" button feature in the jupyter plugin
	LatestCommit         string `json:"latest_commit"`           // the latest available commit on the branch, last time RefreshMountState() was called. written by fsm
	HowManyCommitsBehind int    `json:"how_many_commits_behind"` // how many commits are behind the latest commit on the branch. written by fsm
}

type MountStateMachine

type MountStateMachine struct {
	MountState
	// contains filtered or unexported fields
}

func NewMountStateMachine

func NewMountStateMachine(name string, mm *MountManager) *MountStateMachine

func (*MountStateMachine) RefreshMountState

func (m *MountStateMachine) RefreshMountState() error

func (*MountStateMachine) Run

func (m *MountStateMachine) Run()

type Options

type Options struct {
	Fuse *fs.Options

	// Write indicates that the pfs mount should allow writes.
	// Writes will be written back to the filesystem.
	Write bool

	// RepoOptions is a map from mount names to options associated with them.
	RepoOptions map[string]*RepoOptions

	// Unmount is a channel that will be closed when the filesystem has been
	// unmounted. It can be nil in which case it's ignored.
	Unmount chan struct{}
}

Options is for configuring fuse mounts. Any of the fields may be left nil and `nil` itself is a valid set of Options which uses the default for everything.

type RepoOptions

type RepoOptions struct {
	// Name is the name _of the mount_. This is needed because the mount might
	// have a different name to the repo, to support mounting multiple versions
	// of the same repo at the same time.
	Name string

	// Files is the set of files from a single repo to mount. Most of the time,
	// there will only be one file in this list. However, when mounting datums
	// it's possible to have multiple files from the same repo that need to be
	// mounted. It's best if these files don't overlap.
	Files []*pfs.File
	// Repo is the name of the repo to mount
	// Repo string
	// Branch is the branch of the repo to mount
	// Branch string
	// Commit is a specific commit on the branch to mount
	// Commit string
	// Write indicates that the repo should be mounted for writing.
	Write bool
}

RepoOptions are the options associated with a mounted repo.

type RepoResponse

type RepoResponse struct {
	Project       string   `json:"project"`
	Repo          string   `json:"repo"`
	Branches      []string `json:"branches"`
	Authorization string   `json:"authorization"` // "off", "none", "read", "write"

}

type Request

type Request struct {
	*MountInfo
	Action string // default empty, set to "commit" if we want to commit (verb) a mounted branch
}

type Response

type Response struct {
	Project    string
	Repo       string
	Branch     string
	Commit     string // "" for no commit
	Name       string
	MountState MountState
	Error      error
}

type ServerOptions

type ServerOptions struct {
	MountDir string
	// Unmount is a channel that will be closed when the filesystem has been
	// unmounted. It can be nil in which case it's ignored.
	Unmount chan struct{}
	// True if allow-other option is to be specified
	AllowOther bool
	// Socket directory for Unix Domain Socket
	SockPath string
}

type StateFn

type StateFn func(*MountStateMachine) StateFn

type UnmountRequest

type UnmountRequest struct {
	Mounts []string `json:"mounts"`
}

Jump to

Keyboard shortcuts

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