Documentation ¶
Index ¶
- Constants
- func Mount(c *client.APIClient, project, target string, opts *Options) (retErr error)
- func NewLoopbackFile(fd int) fs.FileHandle
- func Server(sopts *ServerOptions, existingClient *client.APIClient) error
- type CommitRequest
- type ConfigRequest
- type DatumAliasKey
- type DatumsResponse
- type ListMountResponse
- type ListRepoResponse
- type MountDatumResponse
- type MountInfo
- type MountManager
- func (mm *MountManager) CommitRepo(name string) (Response, error)
- func (mm *MountManager) FinishAll() (retErr error)
- func (mm *MountManager) ListByMounts() (ListMountResponse, error)
- func (mm *MountManager) ListByRepos() (ListRepoResponse, error)
- func (mm *MountManager) MaybeStartFsm(name string)
- func (mm *MountManager) MountRepo(mi *MountInfo) (Response, error)
- func (mm *MountManager) Run() error
- func (mm *MountManager) Start()
- func (mm *MountManager) UnmountAll() error
- func (mm *MountManager) UnmountRepo(name string) (Response, error)
- type MountRequest
- type MountState
- type MountStateMachine
- type Options
- type RepoOptions
- type RepoResponse
- type Request
- type Response
- type ServerOptions
- type StateFn
- type UnmountRequest
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 ¶
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.
Types ¶
type CommitRequest ¶
type CommitRequest struct {
Mount string `json:"mount"`
}
type ConfigRequest ¶
type DatumAliasKey ¶
type DatumsResponse ¶
type ListMountResponse ¶
type ListMountResponse struct { Mounted []MountState `json:"mounted"` Unmounted []RepoResponse `json:"unmounted"` }
type ListRepoResponse ¶
type ListRepoResponse []RepoResponse
type MountDatumResponse ¶
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 DatumAlias map[DatumAliasKey]string CurrDatumIdx int Cleanup chan struct{} // contains filtered or unexported fields }
func CreateMount ¶
func CreateMount(c *client.APIClient, mountDir string) (*MountManager, error)
func NewMountManager ¶
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) 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 ActualMountedCommit string `json:"actual_mounted_commit"` // the actual commit that was mounted at mount time. written by fsm 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 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{} }
type StateFn ¶
type StateFn func(*MountStateMachine) StateFn
type UnmountRequest ¶
type UnmountRequest struct {
Mounts []string `json:"mounts"`
}
Click to show internal directories.
Click to hide internal directories.