libfuse

package
v0.0.0-...-5f77811 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2016 License: BSD-3-Clause Imports: 22 Imported by: 0

README

Library code gluing together KBFS and the FUSE protocol.

(TODO: Fill in more details.)

Documentation

Index

Constants

View Source
const (
	// PublicName is the name of the parent of all public top-level folders.
	PublicName = "public"

	// PrivateName is the name of the parent of all private top-level folders.
	PrivateName = "private"

	// CtxAppIDKey is the context app id
	CtxAppIDKey = "kbfsfuse-app-id"

	// CtxOpID is the display name for the unique operation FUSE ID tag.
	CtxOpID = "FID"
)
View Source
const UpdateHistoryFileName = ".kbfs_update_history"

UpdateHistoryFileName is the name of the KBFS update history -- it can be reached anywhere within a top-level folder.

Variables

This section is empty.

Functions

func GetPlatformSpecificMountOptionsForTest

func GetPlatformSpecificMountOptionsForTest() []fuse.MountOption

GetPlatformSpecificMountOptionsForTest makes cross-platform tests work

func GetPlatformUsageString

func GetPlatformUsageString() string

GetPlatformUsageString returns a string to be included in a usage string corresponding to the flags added by AddPlatformFlags.

func Start

func Start(mounter Mounter, options StartOptions, kbCtx libkbfs.Context) *libfs.Error

Start the filesystem

Types

type Alias

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

Alias is a top-level folder accessed through its non-canonical name.

func (*Alias) Attr

func (*Alias) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for Alias.

func (a *Alias) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error)

Readlink implements the fs.NodeReadlinker interface for Alias.

type CtxTagKey

type CtxTagKey int

CtxTagKey is the type used for unique context tags

const (
	// CtxIDKey is the type of the tag for unique operation IDs.
	CtxIDKey CtxTagKey = iota
)

type DefaultMounter

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

DefaultMounter will only call fuse.Mount and fuse.Unmount directly

func NewDefaultMounter

func NewDefaultMounter(dir string, platformParams PlatformParams) DefaultMounter

NewDefaultMounter creates a default mounter.

func (DefaultMounter) Dir

func (m DefaultMounter) Dir() string

Dir returns mount directory.

func (DefaultMounter) Mount

func (m DefaultMounter) Mount() (*fuse.Conn, error)

Mount uses default mount

func (DefaultMounter) Unmount

func (m DefaultMounter) Unmount() error

Unmount uses default unmount

type Dir

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

Dir represents a subdirectory of a KBFS top-level folder (including the TLF root directory itself).

func (*Dir) Attr

func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) (err error)

Attr implements the fs.Node interface for Dir.

func (*Dir) Create

func (d *Dir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (node fs.Node, handle fs.Handle, err error)

Create implements the fs.NodeCreater interface for Dir.

func (*Dir) Forget

func (d *Dir) Forget()

Forget kernel reference to this node.

func (*Dir) Lookup

func (d *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (node fs.Node, err error)

Lookup implements the fs.NodeRequestLookuper interface for Dir.

func (*Dir) Mkdir

func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (
	node fs.Node, err error)

Mkdir implements the fs.NodeMkdirer interface for Dir.

func (*Dir) ReadDirAll

func (d *Dir) ReadDirAll(ctx context.Context) (res []fuse.Dirent, err error)

ReadDirAll implements the fs.NodeReadDirAller interface for Dir.

func (*Dir) Remove

func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) (err error)

Remove implements the fs.NodeRemover interface for Dir.

func (*Dir) Rename

func (d *Dir) Rename(ctx context.Context, req *fuse.RenameRequest,
	newDir fs.Node) (err error)

Rename implements the fs.NodeRenamer interface for Dir.

func (*Dir) Setattr

func (d *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) (err error)

Setattr implements the fs.NodeSetattrer interface for Dir.

func (d *Dir) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (
	node fs.Node, err error)

Symlink implements the fs.NodeSymlinker interface for Dir.

type DirInterface

DirInterface gathers all the interfaces a Dir or something that wraps a Dir should implement.

type FS

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

FS implements the newfuse FS interface for KBFS.

func NewFS

func NewFS(config libkbfs.Config, conn *fuse.Conn, debug bool) *FS

NewFS creates an FS

func (*FS) LaunchNotificationProcessor

func (f *FS) LaunchNotificationProcessor(ctx context.Context)

LaunchNotificationProcessor launches the notification processor.

func (*FS) NotificationGroupWait

func (f *FS) NotificationGroupWait()

NotificationGroupWait - wait on the notification group.

func (*FS) Root

func (f *FS) Root() (fs.Node, error)

Root implements the fs.FS interface for FS.

func (*FS) Serve

func (f *FS) Serve(ctx context.Context) error

Serve FS. Will block.

func (*FS) SetFuseConn

func (f *FS) SetFuseConn(fuse *fs.Server, conn *fuse.Conn)

SetFuseConn sets fuse connection for this FS.

func (*FS) Statfs

func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error

Statfs implements the fs.FSStatfser interface for FS.

func (*FS) WithContext

func (f *FS) WithContext(ctx context.Context) context.Context

WithContext adds app- and request-specific values to the context. It is called by FUSE for normal runs, but may be called explicitly in other settings, such as tests.

type File

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

File represents KBFS files.

func (*File) Attr

func (f *File) Attr(ctx context.Context, a *fuse.Attr) (err error)

Attr implements the fs.Node interface for File.

func (*File) Flush

func (f *File) Flush(ctx context.Context, req *fuse.FlushRequest) (err error)

Flush implements the fs.HandleFlusher interface for File.

func (*File) Forget

func (f *File) Forget()

Forget kernel reference to this node.

func (*File) Fsync

func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error)

Fsync implements the fs.NodeFsyncer interface for File.

func (*File) Read

func (f *File) Read(ctx context.Context, req *fuse.ReadRequest,
	resp *fuse.ReadResponse) (err error)

Read implements the fs.HandleReader interface for File.

func (*File) Setattr

func (f *File) Setattr(ctx context.Context, req *fuse.SetattrRequest,
	resp *fuse.SetattrResponse) (err error)

Setattr implements the fs.NodeSetattrer interface for File.

func (*File) Write

func (f *File) Write(ctx context.Context, req *fuse.WriteRequest,
	resp *fuse.WriteResponse) (err error)

Write implements the fs.HandleWriter interface for File.

type Folder

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

Folder represents the info shared among all nodes of a KBFS top-level folder.

func (*Folder) BatchChanges

func (f *Folder) BatchChanges(ctx context.Context, changes []libkbfs.NodeChange)

BatchChanges is called for changes originating anywhere, including other hosts.

func (*Folder) LocalChange

func (f *Folder) LocalChange(ctx context.Context, node libkbfs.Node, write libkbfs.WriteRange)

LocalChange is called for changes originating within in this process.

func (*Folder) TlfHandleChange

func (f *Folder) TlfHandleChange(ctx context.Context,
	newHandle *libkbfs.TlfHandle)

TlfHandleChange is called when the name of a folder changes.

type FolderList

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

FolderList is a node that can list all of the logged-in user's favorite top-level folders, on either a public or private basis.

func (*FolderList) Attr

func (*FolderList) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface.

func (*FolderList) Lookup

func (fl *FolderList) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (node fs.Node, err error)

Lookup implements the fs.NodeRequestLookuper interface.

func (*FolderList) ReadDirAll

func (fl *FolderList) ReadDirAll(ctx context.Context) (res []fuse.Dirent, err error)

ReadDirAll implements the ReadDirAll interface.

func (*FolderList) Remove

func (fl *FolderList) Remove(ctx context.Context, req *fuse.RemoveRequest) (err error)

Remove implements the fs.NodeRemover interface for FolderList.

type ForceMounter

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

ForceMounter will try its best to get it a mount

func NewForceMounter

func NewForceMounter(dir string, platformParams PlatformParams) ForceMounter

NewForceMounter creates a force mounter.

func (ForceMounter) Dir

func (m ForceMounter) Dir() string

Dir returns mount directory.

func (ForceMounter) Mount

func (m ForceMounter) Mount() (*fuse.Conn, error)

Mount tries to mount and then unmount, re-mount if unsuccessful

func (ForceMounter) Unmount

func (m ForceMounter) Unmount() (err error)

Unmount tries to unmount normally and then force if unsuccessful

type JournalControlFile

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

JournalControlFile is a special file used to control journal settings.

func (*JournalControlFile) Attr

func (f *JournalControlFile) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for JournalControlFile.

func (*JournalControlFile) Write

func (f *JournalControlFile) Write(ctx context.Context, req *fuse.WriteRequest,
	resp *fuse.WriteResponse) (err error)

Write implements the fs.HandleWriter interface for JournalControlFile.

type Mounter

type Mounter interface {
	Dir() string
	Mount() (*fuse.Conn, error)
	Unmount() error
}

Mounter defines interface for different mounting strategies

type PlatformParams

type PlatformParams struct{}

PlatformParams contains all platform-specific parameters to be passed to New{Default,Force}Mounter.

func AddPlatformFlags

func AddPlatformFlags(flags *flag.FlagSet) *PlatformParams

AddPlatformFlags adds platform-specific flags to the given FlagSet and returns a PlatformParams object that will be filled in when the given FlagSet is parsed.

type ProfileList

type ProfileList struct{}

ProfileList is a node that can list all of the available profiles.

func (ProfileList) Attr

func (ProfileList) Attr(_ context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface.

func (ProfileList) Lookup

func (pl ProfileList) Lookup(_ context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (node fs.Node, err error)

Lookup implements the fs.NodeRequestLookuper interface.

func (ProfileList) ReadDirAll

func (pl ProfileList) ReadDirAll(_ context.Context) (res []fuse.Dirent, err error)

ReadDirAll implements the ReadDirAll interface.

func (ProfileList) Remove

func (ProfileList) Remove(_ context.Context, req *fuse.RemoveRequest) (err error)

Remove implements the fs.NodeRemover interface for ProfileList.

type ReclaimQuotaFile

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

ReclaimQuotaFile represents a write-only file when any write of at least one byte triggers a quota reclamation of the folder.

func (*ReclaimQuotaFile) Attr

func (f *ReclaimQuotaFile) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for ReclaimQuotaFile.

func (*ReclaimQuotaFile) Write

func (f *ReclaimQuotaFile) Write(ctx context.Context, req *fuse.WriteRequest,
	resp *fuse.WriteResponse) (err error)

Write implements the fs.HandleWriter interface for ReclaimQuotaFile. Note a write triggers quota reclamation, but does not wait for it to finish. If you want to wait, write to SyncFromServerFileName.

type RekeyFile

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

RekeyFile represents a write-only file when any write of at least one byte triggers a rekey of the folder.

func (*RekeyFile) Attr

func (f *RekeyFile) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for RekeyFile.

func (*RekeyFile) Write

func (f *RekeyFile) Write(ctx context.Context, req *fuse.WriteRequest,
	resp *fuse.WriteResponse) (err error)

Write implements the fs.HandleWriter interface for RekeyFile.

type ResetCachesFile

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

ResetCachesFile represents a write-only file where any write of at least one byte triggers the resetting of all data caches. It can be reached from any directory under the FUSE mountpoint. Note that it does not clear the *node* cache, which means that the BlockPointers for existing nodes are still cached, such that directory listings can still be implicitly cached for nodes still being held by the kernel.

func (*ResetCachesFile) Attr

func (f *ResetCachesFile) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for ResetCachesFile.

func (*ResetCachesFile) Write

func (f *ResetCachesFile) Write(ctx context.Context, req *fuse.WriteRequest,
	resp *fuse.WriteResponse) (err error)

Write implements the fs.HandleWriter interface for ResetCachesFile.

type Root

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

Root represents the root of the KBFS file system.

func (*Root) Attr

func (*Root) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for Root.

func (*Root) Lookup

func (r *Root) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (_ fs.Node, err error)

Lookup implements the fs.NodeRequestLookuper interface for Root.

func (*Root) ReadDirAll

func (r *Root) ReadDirAll(ctx context.Context) (res []fuse.Dirent, err error)

ReadDirAll implements the ReadDirAll interface for Root.

type SpecialReadFile

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

SpecialReadFile represents a file whose contents are determined by a function.

func NewErrorFile

func NewErrorFile(fs *FS, resp *fuse.LookupResponse) *SpecialReadFile

NewErrorFile returns a special read file that contains a text representation of the last few KBFS errors.

func NewMetricsFile

func NewMetricsFile(fs *FS, resp *fuse.LookupResponse) *SpecialReadFile

NewMetricsFile returns a special read file that contains a text representation of all metrics.

func NewStatusFile

func NewStatusFile(fs *FS, folderBranch *libkbfs.FolderBranch, resp *fuse.LookupResponse) *SpecialReadFile

NewStatusFile returns a special read file that contains a text representation of the status of the current TLF.

func NewTlfEditHistoryFile

func NewTlfEditHistoryFile(fs *FS, folderBranch libkbfs.FolderBranch,
	resp *fuse.LookupResponse) *SpecialReadFile

NewTlfEditHistoryFile returns a special read file that contains a text representation of the file edit history for that TLF.

func NewUpdateHistoryFile

func NewUpdateHistoryFile(folder *Folder,
	resp *fuse.LookupResponse) *SpecialReadFile

NewUpdateHistoryFile returns a special read file that contains a text representation of the update history of the current TLF.

func (*SpecialReadFile) Attr

func (f *SpecialReadFile) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for SpecialReadFile.

func (*SpecialReadFile) Open

Open implements the fs.NodeOpener interface for SpecialReadFile.

type StartOptions

type StartOptions struct {
	KbfsParams libkbfs.InitParams
	RuntimeDir string
	Label      string
}

StartOptions are options for starting up

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

Symlink represents KBFS symlinks.

func (*Symlink) Attr

func (s *Symlink) Attr(ctx context.Context, a *fuse.Attr) (err error)

Attr implements the fs.Node interface for Symlink

func (s *Symlink) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (link string, err error)

Readlink implements the fs.NodeReadlinker interface for Symlink

type SyncFromServerFile

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

SyncFromServerFile represents a write-only file when any write of at least one byte triggers a sync of the folder from the server. A sync:

  • Waits for any outstanding conflict resolution tasks to finish (and it fails if the TLF is still in staged mode after waiting for CR).
  • Checks with the server for what the latest revision is for the folder.
  • Fetches and applies any missing revisions.
  • Waits for all outstanding block archive tasks to complete.
  • Waits for all outstanding quota reclamation tasks to complete.

func (*SyncFromServerFile) Attr

func (f *SyncFromServerFile) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for SyncFromServerFile.

func (*SyncFromServerFile) Write

func (f *SyncFromServerFile) Write(ctx context.Context, req *fuse.WriteRequest,
	resp *fuse.WriteResponse) (err error)

Write implements the fs.HandleWriter interface for SyncFromServerFile.

type TLF

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

TLF represents the root directory of a TLF. It wraps a lazy-loaded Dir.

func (*TLF) Attr

func (tlf *TLF) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for TLF.

func (*TLF) Create

func (tlf *TLF) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)

Create implements the fs.NodeCreater interface for TLF.

func (*TLF) Forget

func (tlf *TLF) Forget()

Forget kernel reference to this node.

func (*TLF) Lookup

func (tlf *TLF) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (fs.Node, error)

Lookup implements the fs.NodeRequestLookuper interface for TLF.

func (*TLF) Mkdir

func (tlf *TLF) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (
	fs.Node, error)

Mkdir implements the fs.NodeMkdirer interface for TLF.

func (*TLF) Open

func (tlf *TLF) Open(ctx context.Context, req *fuse.OpenRequest,
	resp *fuse.OpenResponse) (fs.Handle, error)

Open implements the fs.NodeOpener interface for TLF.

func (*TLF) ReadDirAll

func (tlf *TLF) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

ReadDirAll implements the fs.NodeReadDirAller interface for TLF.

func (*TLF) Remove

func (tlf *TLF) Remove(ctx context.Context, req *fuse.RemoveRequest) error

Remove implements the fs.NodeRemover interface for TLF.

func (*TLF) Rename

func (tlf *TLF) Rename(ctx context.Context, req *fuse.RenameRequest,
	newDir fs.Node) error

Rename implements the fs.NodeRenamer interface for TLF.

func (*TLF) Setattr

func (tlf *TLF) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error

Setattr implements the fs.NodeSetattrer interface for TLF.

func (tlf *TLF) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (
	fs.Node, error)

Symlink implements the fs.NodeSymlinker interface for TLF.

type UnstageFile

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

UnstageFile represents a write-only file when any write of at least one byte triggers unstaging all unmerged commits and fast-forwarding to the current master.

func (*UnstageFile) Attr

func (f *UnstageFile) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for UnstageFile.

func (*UnstageFile) Write

func (f *UnstageFile) Write(ctx context.Context, req *fuse.WriteRequest,
	resp *fuse.WriteResponse) (err error)

Write implements the fs.HandleWriter interface for UnstageFile.

type UpdatesFile

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

UpdatesFile represents a write-only file where any write of at least one byte triggers either disabling remote folder updates and conflict resolution, or re-enabling both. It is mainly useful for testing.

func (*UpdatesFile) Attr

func (f *UpdatesFile) Attr(ctx context.Context, a *fuse.Attr) error

Attr implements the fs.Node interface for UpdatesFile.

func (*UpdatesFile) Write

func (f *UpdatesFile) Write(ctx context.Context, req *fuse.WriteRequest,
	resp *fuse.WriteResponse) (err error)

Write implements the fs.HandleWriter interface for UpdatesFile.

Jump to

Keyboard shortcuts

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