fuse

package
v2.8.0-nightly.20230919 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 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
)

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 DatumsResponse

type DatumsResponse struct {
	NumDatums int        `json:"num_datums"`
	Input     *pps.Input `json:"input"`
	CurrIdx   int        `json:"curr_idx"`
}

type ListMountResponse

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

type ListRepoResponse

type ListRepoResponse []RepoResponse

type MountDatumResponse

type MountDatumResponse struct {
	Id        string `json:"id"`
	Idx       int    `json:"idx"`
	NumDatums int    `json:"num_datums"`
}

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)
	Files   []string `json:"files"`
	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

	Datums              []*pps.DatumInfo
	DatumInput          *pps.Input
	DatumInputsToMounts map[string]string
	CurrDatumIdx        int

	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) FinishAll

func (mm *MountManager) FinishAll() (retErr 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

	File     *pfs.File
	Subpaths []string
	// 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
}

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