Documentation ¶
Index ¶
- Constants
- func Mount(c *client.APIClient, project, target string, opts *Options) (retErr error)
- func NewLoopbackFile(fd int) fs.FileHandle
- func Serve(ctx context.Context, sopts *ServerOptions, existingClient *client.APIClient) error
- type CommitRequest
- type ConfigRequest
- type DatumState
- type DatumsResponse
- type ListMountResponse
- type ListRepoResponse
- type MountDatumResponse
- type MountInfo
- type MountManager
- func (mm *MountManager) CommitRepo(name string) (Response, error)
- func (mm *MountManager) CreateDatums() error
- func (mm *MountManager) FinishAll() (retErr error)
- func (mm *MountManager) GetDatums() (retErr error)
- func (mm *MountManager) GetNextXDatums(numDatums int, paginationMarker string) ([]*pps.DatumInfo, 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 ¶
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 )
const FuseServerPort = ":9002"
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
const Separator = string(filepath.Separator)
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 DatumState ¶ added in v2.8.0
type DatumState struct { Datums []*pps.DatumInfo PaginationMarker string DatumInput *pps.Input // SimpleInput tracks whether 'DatumInput' is simple (i.e. not a group by or // join). This is set by 'parseInput', and later read by 'GetDatums' to // decide whether to list datums using Pachyderm's 'GlobFile' or 'ListDatum' // call SimpleInput bool DatumInputToNames map[string][]string DatumIdx int AllDatumsReceived bool }
type DatumsResponse ¶
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 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 NewMountManager ¶
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() (retErr error)
func (*MountManager) GetNextXDatums ¶ added in v2.8.0
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 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 // 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 is the directory where the mount will be created (the most // conventional and typically most useful value for this field is '/pfs', // causing mount-server to lay out files in the same way as Pachyderm's worker // binary. Code that correctly reads and writes data in this configuration can // then be run inside a Pachyderm pipeline without modification). 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{} // AllowOther, if true, configures mount-server to give read and write // permissions to "other" on the mount point ('chmod u+rw /pfs', effectively) AllowOther bool // SockPath, if set, configures mount-server to serve over a Unix socket at // the path it contains. SockPath string }
type StateFn ¶
type StateFn func(*MountStateMachine) StateFn
type UnmountRequest ¶
type UnmountRequest struct {
Mounts []string `json:"mounts"`
}