Documentation ¶
Index ¶
- Constants
- Variables
- func AddRootWrapper(config libkbfs.Config)
- func BranchNameFromArchiveRefDir(dir string) (data.BranchName, bool)
- func Deobfuscate(ctx context.Context, fs *FS, obfuscatedPath string) ([]string, error)
- func EnableFastMode(ctx context.Context) context.Context
- func FileDataFromRelativeTimeString(ctx context.Context, config libkbfs.Config, h *tlfhandle.Handle, ...) ([]byte, bool, error)
- func FilterTLFEarlyExitError(ctx context.Context, err error, log logger.Logger, name tlf.CanonicalName) (exitEarly bool, retErr error)
- func GetEncodedErrors(config libkbfs.Config) func(context.Context) ([]byte, time.Time, error)
- func GetEncodedFolderStatus(ctx context.Context, config libkbfs.Config, folderBranch data.FolderBranch) (data []byte, t time.Time, err error)
- func GetEncodedMetrics(config libkbfs.Config) func(context.Context) ([]byte, time.Time, error)
- func GetEncodedStatus(ctx context.Context, config libkbfs.Config) (data []byte, t time.Time, err error)
- func GetEncodedTlfEditHistory(ctx context.Context, config libkbfs.Config, folderBranch data.FolderBranch) (data []byte, t time.Time, err error)
- func GetEncodedUpdateHistory(ctx context.Context, config libkbfs.Config, folderBranch data.FolderBranch) (data []byte, t time.Time, err error)
- func GetEncodedUserEditHistory(ctx context.Context, config libkbfs.Config) (data []byte, t time.Time, err error)
- func GetFileInfo(ctx context.Context, config libkbfs.Config, dir libkbfs.Node, name string) (data []byte, t time.Time, err error)
- func IsFastModeEnabled(ctx context.Context) bool
- func IsSupportedProfileName(name string) bool
- func IsWriter(ctx context.Context, kbpki libkbfs.KBPKI, osg idutil.OfflineStatusGetter, ...) (bool, error)
- func LinkTargetFromTimeString(ctx context.Context, config libkbfs.Config, h *tlfhandle.Handle, link string) (string, bool, error)
- func PrettyJSON(value interface{}) ([]byte, error)
- func ProfileGet(name string) func(context.Context) ([]byte, time.Time, error)
- func RecursiveDelete(ctx context.Context, fs billy.Filesystem, fi os.FileInfo) error
- func RevFromRelativeTimeString(ctx context.Context, config libkbfs.Config, h *tlfhandle.Handle, ...) (kbfsmd.Revision, error)
- func RevFromTimeString(ctx context.Context, config libkbfs.Config, h *tlfhandle.Handle, ...) (kbfsmd.Revision, error)
- func TimeEqual(a, b time.Time) bool
- func UnstageForTesting(ctx context.Context, log logger.Logger, config libkbfs.Config, ...) (int, error)
- func WritePermMode(ctx context.Context, node libkbfs.Node, original os.FileMode, ...) (os.FileMode, error)
- type CtxAppIDType
- type ErrNotADirectory
- type Error
- type FS
- func NewFS(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, ...) (*FS, error)
- func NewFSIfExists(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, ...) (*FS, error)
- func NewReadonlyFS(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, ...) (*FS, error)
- func NewUnwrappedFS(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, ...) (*FS, error)
- func (fs *FS) Chmod(name string, mode os.FileMode) (err error)
- func (fs *FS) Chown(name string, uid, gid int) error
- func (fs *FS) Chroot(p string) (newFS billy.Filesystem, err error)
- func (fs *FS) ChrootAsLibFS(p string) (newFS *FS, err error)
- func (fs *FS) Chtimes(name string, atime time.Time, mtime time.Time) (err error)
- func (fs *FS) Config() libkbfs.Config
- func (fs *FS) Create(filename string) (billy.File, error)
- func (fs *FS) GetLockNamespace() (lockNamespace []byte)
- func (fs *FS) Handle() *tlfhandle.Handle
- func (fs *FS) IsEmpty() bool
- func (fs *FS) Join(elem ...string) string
- func (fs *FS) Lchown(name string, uid, gid int) error
- func (fs *FS) Lstat(filename string) (fi os.FileInfo, err error)
- func (fs *FS) MkdirAll(filename string, perm os.FileMode) (err error)
- func (fs *FS) Open(filename string) (billy.File, error)
- func (fs *FS) OpenFile(filename string, flag int, perm os.FileMode) (f billy.File, err error)
- func (fs *FS) PathForLogging(filename string) string
- func (fs *FS) ReadDir(p string) (fis []os.FileInfo, err error)
- func (fs *FS) Readlink(link string) (target string, err error)
- func (fs *FS) Remove(filename string) (err error)
- func (fs *FS) Rename(oldpath, newpath string) (err error)
- func (fs *FS) Root() string
- func (fs *FS) RootNode() libkbfs.Node
- func (fs *FS) SetLockNamespace(lockNamespace []byte)
- func (fs *FS) Stat(filename string) (fi os.FileInfo, err error)
- func (fs *FS) SubscribeToEvents(ch chan<- FSEvent)
- func (fs *FS) SubscribeToObsolete() (<-chan struct{}, error)
- func (fs *FS) Symlink(target, link string) (err error)
- func (fs *FS) SyncAll() error
- func (fs *FS) TempFile(dir, prefix string) (billy.File, error)
- func (fs *FS) ToHTTPFileSystem(ctx context.Context) http.FileSystem
- func (fs *FS) UnsubscribeToEvents(ch chan<- FSEvent)
- func (fs *FS) WithContext(ctx context.Context) *FS
- type FSEvent
- type FSEventType
- type FSNotifications
- type File
- func (f *File) Close() error
- func (f *File) GetNode() libkbfs.Node
- func (f *File) Lock() (err error)
- func (f *File) Name() string
- func (f *File) Read(p []byte) (n int, err error)
- func (f *File) ReadAt(p []byte, off int64) (n int, err error)
- func (f *File) Seek(offset int64, whence int) (n int64, err error)
- func (f *File) Truncate(size int64) error
- func (f *File) Unlock() (err error)
- func (f *File) Write(p []byte) (n int, err error)
- type FileInfo
- type FileInfoFast
- type JSONReportedError
- type JournalAction
- type KBFSMetadataForSimpleFS
- type KBFSMetadataForSimpleFSGetter
- type MountInterrupter
- type Mounter
- type PrevRevisionsGetter
- type RemoteStatus
- type RemoteStatusUpdater
- type RootFS
- func (rfs *RootFS) Chroot(_ string) (newFS billy.Filesystem, err error)
- func (rfs *RootFS) Create(_ string) (billy.File, error)
- func (rfs *RootFS) Join(elem ...string) string
- func (rfs *RootFS) Lstat(filename string) (fi os.FileInfo, err error)
- func (rfs *RootFS) MkdirAll(_ string, _ os.FileMode) (err error)
- func (rfs *RootFS) Open(filename string) (f billy.File, err error)
- func (rfs *RootFS) OpenFile(filename string, flag int, _ os.FileMode) (f billy.File, err error)
- func (rfs *RootFS) ReadDir(p string) (fis []os.FileInfo, err error)
- func (rfs *RootFS) Readlink(_ string) (target string, err error)
- func (rfs *RootFS) Remove(_ string) (err error)
- func (rfs *RootFS) Rename(_, _ string) (err error)
- func (rfs *RootFS) Root() string
- func (rfs *RootFS) Stat(filename string) (fi os.FileInfo, err error)
- func (rfs *RootFS) Symlink(_, _ string) (err error)
- func (rfs *RootFS) TempFile(_, _ string) (billy.File, error)
- func (rfs *RootFS) ToHTTPFileSystem(ctx context.Context) http.FileSystem
- type SyncAction
- type TlfDoesNotExist
Constants ¶
const ( // InitErrorCode is the error code for initialization errors InitErrorCode = 1 // MountErrorCode is the error code for mount errors MountErrorCode = 2 )
const ( HumanErrorFileName = "kbfs.error.txt" HumanNoLoginFileName = "kbfs.nologin.txt" )
Special files in root directory.
const ArchivedRelTimeFilePrefix = ".kbfs_archived_reltime="
ArchivedRelTimeFilePrefix is the prefix to the file at the root of a TLF that contains the directory name of an archived revision described by the given relative time.
const ArchivedRevDirPrefix = ".kbfs_archived_rev="
ArchivedRevDirPrefix is the prefix to the directory at the root of a TLF that exposes a version of that TLF at the specified revision.
const ArchivedTimeLinkPrefix = ".kbfs_archived_time="
ArchivedTimeLinkPrefix is the prefix to the symlink at the root of a TLF that links to a version of that TLF at the specified time.
const DisableAutoJournalsFileName = ".kbfs_disable_auto_journals"
DisableAutoJournalsFileName is the name of the KBFS-wide auto-journal-disabling file. It's accessible anywhere outside a TLF.
const DisableBlockPrefetchingFileName = ".kbfs_disable_block_prefetching"
DisableBlockPrefetchingFileName is the name of the KBFS-wide prefetching-disabling file. It's accessible anywhere outside a TLF.
const DisableDebugServerFileName = ".kbfs_disable_debug_server"
DisableDebugServerFileName is the name of the file to turn on the debug HTTP server. It's accessible anywhere outside a TLF.
const DisableJournalFileName = ".kbfs_disable_journal"
DisableJournalFileName is the name of the journal-disabling file. It can be reached anywhere within a top-level folder.
const DisableSyncFileName = ".kbfs_disable_sync"
DisableSyncFileName is the name of the file to disable the sync cache for a TLF. It can be reached anywhere within a TLF.
const DisableUpdatesFileName = ".kbfs_disable_updates"
DisableUpdatesFileName is the name of the KBFS update-disabling file -- it can be reached anywhere within a top-level folder.
const EditHistoryName = ".kbfs_edit_history"
EditHistoryName is the name of the KBFS TLF edit history file -- it can be reached anywhere within a top-level folder.
const EnableAutoJournalsFileName = ".kbfs_enable_auto_journals"
EnableAutoJournalsFileName is the name of the KBFS-wide auto-journal-enabling file. It's accessible anywhere outside a TLF.
const EnableBlockPrefetchingFileName = ".kbfs_enable_block_prefetching"
EnableBlockPrefetchingFileName is the name of the KBFS-wide prefetching-enabling file. It's accessible anywhere outside a TLF.
const EnableDebugServerFileName = ".kbfs_enable_debug_server"
EnableDebugServerFileName is the name of the file to turn on the debug HTTP server. It's accessible anywhere outside a TLF.
const EnableJournalFileName = ".kbfs_enable_journal"
EnableJournalFileName is the name of the journal-enabling file. It can be reached anywhere within a top-level folder.
const EnableSyncFileName = ".kbfs_enable_sync"
EnableSyncFileName is the name of the file to enable the sync cache for a TLF. It can be reached anywhere within a TLF.
const EnableUpdatesFileName = ".kbfs_enable_updates"
EnableUpdatesFileName is the name of the KBFS update-enabling file -- it can be reached anywhere within a top-level folder.
const FileInfoPrefix = ".kbfs_fileinfo_"
FileInfoPrefix is the prefix of the per-file metadata files.
const FlushJournalFileName = ".kbfs_flush_journal"
FlushJournalFileName is the name of the journal-flushing file. It can be reached anywhere within a top-level folder.
const MetricsFileName = ".kbfs_metrics"
MetricsFileName is the name of the KBFS metrics file -- it can be reached from any KBFS directory.
const PauseJournalBackgroundWorkFileName = ".kbfs_pause_journal_background_work"
PauseJournalBackgroundWorkFileName is the name of the file that pauses the background work of a journal. It can be reached anywhere within a top-level folder.
const ProfileListDirName = ".kbfs_profiles"
ProfileListDirName is the name of the KBFS profile directory -- it can be reached from any KBFS directory.
const ReclaimQuotaFileName = ".kbfs_reclaim_quota"
ReclaimQuotaFileName is the name of the KBFS quota-reclaiming file -- it can be reached anywhere within a top-level folder.
const RekeyFileName = ".kbfs_rekey"
RekeyFileName is the name of the KBFS rekeying file -- it can be reached anywhere within a top-level folder.
const ResetCachesFileName = ".kbfs_reset_caches"
ResetCachesFileName is the name of the KBFS unstaging file.
const ResumeJournalBackgroundWorkFileName = ".kbfs_resume_journal_background_work"
ResumeJournalBackgroundWorkFileName is the name of the file that resumes the background work of a journal. It can be reached anywhere within a top-level folder.
const StatusFileName = ".kbfs_status"
StatusFileName is the name of the KBFS status file -- it can be reached anywhere within a top-level folder or inside the Keybase root
const SyncFromServerFileName = ".kbfs_sync_from_server"
SyncFromServerFileName is the name of the KBFS sync-from-server file -- it can be reached anywhere within a top-level folder.
const UnstageFileName = ".kbfs_unstage"
UnstageFileName is the name of the KBFS unstaging file -- it can be reached anywhere within a top-level folder.
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 ¶
var ErrUnknownPrefetchStatus = errors.New(
"Failed to determine prefetch status")
ErrUnknownPrefetchStatus is returned when the prefetch status given by the KBFSOps's NodeMetadata is invalid.
Functions ¶
func AddRootWrapper ¶
AddRootWrapper should be called on startup by any KBFS interface that wants to handle special files.
func BranchNameFromArchiveRefDir ¶
func BranchNameFromArchiveRefDir(dir string) (data.BranchName, bool)
BranchNameFromArchiveRefDir returns a branch name and true if the given directory name is specifying an archived revision with a revision number.
func Deobfuscate ¶
Deobfuscate returns a set of possible plaintext paths, given an obfuscated path as input. The set is ambiguous because of possible conflicts in the obfuscated name. If the last element of the obfuscated path matches the obfuscated version of a symlink target within the target directory, the returned string includes the symlink itself, followed by the target name in parentheses like `/keybase/private/me/link (/etc/passwd)`.
func EnableFastMode ¶
EnableFastMode returns a context.Context based on ctx that will test to true with IsFastModeEnabled.
func FileDataFromRelativeTimeString ¶
func FileDataFromRelativeTimeString( ctx context.Context, config libkbfs.Config, h *tlfhandle.Handle, filename string) ([]byte, bool, error)
FileDataFromRelativeTimeString returns a byte string containing the name of a revision-based archive directory, and true, if the given file name specifies a valid by-relative-time file name. The time is relative to the local clock.
func FilterTLFEarlyExitError ¶
func FilterTLFEarlyExitError(ctx context.Context, err error, log logger.Logger, name tlf.CanonicalName) ( exitEarly bool, retErr error)
FilterTLFEarlyExitError decides whether an error received while trying to create a TLF should result in showing the user an empty folder (exitEarly == true), or not.
func GetEncodedErrors ¶
GetEncodedErrors gets the list of encoded errors in a format suitable for error file.
func GetEncodedFolderStatus ¶
func GetEncodedFolderStatus(ctx context.Context, config libkbfs.Config, folderBranch data.FolderBranch) ( data []byte, t time.Time, err error)
GetEncodedFolderStatus returns serialized JSON containing status information for a folder
func GetEncodedMetrics ¶
GetEncodedMetrics returns metrics encoded as bytes for metrics file.
func GetEncodedStatus ¶
func GetEncodedStatus(ctx context.Context, config libkbfs.Config) ( data []byte, t time.Time, err error)
GetEncodedStatus returns serialized JSON containing top-level KBFS status information
func GetEncodedTlfEditHistory ¶
func GetEncodedTlfEditHistory(ctx context.Context, config libkbfs.Config, folderBranch data.FolderBranch) ( data []byte, t time.Time, err error)
GetEncodedTlfEditHistory returns serialized JSON containing the file edit history for a folder.
func GetEncodedUpdateHistory ¶
func GetEncodedUpdateHistory( ctx context.Context, config libkbfs.Config, folderBranch data.FolderBranch) ( data []byte, t time.Time, err error)
GetEncodedUpdateHistory returns a JSON-encoded version of a TLF's complete update history.
func GetEncodedUserEditHistory ¶
func GetEncodedUserEditHistory(ctx context.Context, config libkbfs.Config) ( data []byte, t time.Time, err error)
GetEncodedUserEditHistory returns serialized JSON containing the file edit history for the user.
func GetFileInfo ¶
func GetFileInfo( ctx context.Context, config libkbfs.Config, dir libkbfs.Node, name string) ( data []byte, t time.Time, err error)
GetFileInfo returns serialized JSON containing status information for a file or directory entry.
func IsFastModeEnabled ¶
IsFastModeEnabled returns true if fast mode should be enabled. In fast mode, *FS doesn't populate LastWriterUnverified, and always returns read-only info. All *FS created under this ctx will also be in fast mode.
func IsSupportedProfileName ¶
IsSupportedProfileName matches a string against allowed profile names.
func IsWriter ¶
func IsWriter(ctx context.Context, kbpki libkbfs.KBPKI, osg idutil.OfflineStatusGetter, h *tlfhandle.Handle) (bool, error)
IsWriter returns whether or not the currently logged-in user is a valid writer for the folder described by `h`.
func LinkTargetFromTimeString ¶
func LinkTargetFromTimeString( ctx context.Context, config libkbfs.Config, h *tlfhandle.Handle, link string) (string, bool, error)
LinkTargetFromTimeString returns the name of a by-revision archive directory, and true, if the given link specifies a valid by-time link name. Ambiguous dates are parsed in MM/DD format.
func PrettyJSON ¶
PrettyJSON marshals a value to human-readable JSON.
func ProfileGet ¶
ProfileGet gets the relevant read function for the profile or nil if it doesn't exist.
func RecursiveDelete ¶
RecursiveDelete deletes the given entry from the given filesystem. If it's a directory, first all the items in the directory are deleted recursively.
func RevFromRelativeTimeString ¶
func RevFromRelativeTimeString( ctx context.Context, config libkbfs.Config, h *tlfhandle.Handle, relTime string) (kbfsmd.Revision, error)
RevFromRelativeTimeString turns a string describing a time in the past relative to now (e.g., "5m", "2h55s"), and turns it into a revision number for the given TLF.
func RevFromTimeString ¶
func RevFromTimeString( ctx context.Context, config libkbfs.Config, h *tlfhandle.Handle, timeString string) (kbfsmd.Revision, error)
RevFromTimeString converts a time string (in any supported golang date format) to the earliest revision number with a server timestamp greater or equal to that time. Ambiguous dates are parsed in MM/DD format.
func TimeEqual ¶
TimeEqual compares two filesystem-related timestamps.
On platforms that don't use nanosecond-accurate timestamps in their filesystem APIs, it truncates the timestamps to make them comparable.
func UnstageForTesting ¶
func UnstageForTesting(ctx context.Context, log logger.Logger, config libkbfs.Config, fb data.FolderBranch, data []byte) (int, error)
UnstageForTesting unstages all unmerged commits and fast-forwards to the current master, if the given data is non-empty. If the given data is empty, it does nothing.
This should only be needed if there is a bug in automatic conflict resolution.
If the given data begins with the bytes "async", the unstaging is done asynchronously, i.e. this function returns immediately and the unstaging happens in the background. (Other subsequent IO operations may be blocked, though.) You can figure out when the unstage succeeds by consulting .kbfs_status.
func WritePermMode ¶
func WritePermMode( ctx context.Context, node libkbfs.Node, original os.FileMode, kbpki libkbfs.KBPKI, osg idutil.OfflineStatusGetter, h *tlfhandle.Handle) (os.FileMode, error)
WritePermMode fills in original based on whether or not the currently logged-in user is a valid writer for the folder described by `h`.
Types ¶
type CtxAppIDType ¶
type CtxAppIDType int
CtxAppIDType is the type used for the app ID context tag
const ( // CtxAppIDKey is the context app id CtxAppIDKey CtxAppIDType = iota )
type ErrNotADirectory ¶
type ErrNotADirectory struct {
Name string
}
ErrNotADirectory is returned when a non-final path element exists but is not a directory.
func (ErrNotADirectory) Error ¶
func (e ErrNotADirectory) Error() string
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS is a wrapper around a KBFS subdirectory that implements the billy.Filesystem interface. It uses forward-slash separated paths. It may return errors wrapped with the `github.com/pkg/errors` package.
func NewFS ¶
func NewFS(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, branch data.BranchName, subdir string, uniqID string, priority keybase1.MDPriority) (*FS, error)
NewFS returns a new FS instance, chroot'd to the given TLF and subdir within that TLF. `subdir` must exist, and point to a directory, before this function is called. `uniqID` needs to uniquely identify this instance among all users of this TLF globally; for example, a device ID combined with a local tempfile name is recommended.
func NewFSIfExists ¶
func NewFSIfExists(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, branch data.BranchName, subdir string, uniqID string, priority keybase1.MDPriority) (*FS, error)
NewFSIfExists returns a new FS instance, chroot'd to the given TLF and subdir within that TLF, but only if the TLF already exists. `subdir` must exist, and point to a directory, before this function is called. `uniqID` needs to uniquely identify this instance among all users of this TLF globally; for example, a device ID combined with a local tempfile name is recommended.
If the TLF hasn't been initialized yet, this will return an FS that is always empty. `IsEmpty()` will tell if you this is happening. If there's a need to re-check the TLF, a new FS must be constructed.
func NewReadonlyFS ¶
func NewReadonlyFS(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, branch data.BranchName, subdir string, uniqID string, priority keybase1.MDPriority) (*FS, error)
NewReadonlyFS returns a new FS instance, chroot'd to the given TLF and subdir within that TLF, but all the nodes are read-only. `subdir` must exist, and point to a directory, before this function is called. `uniqID` needs to uniquely identify this instance among all users of this TLF globally; for example, a device ID combined with a local tempfile name is recommended.
Note that this should only be used for subdirectories that will never be accessed in read-write mode by this process, because the nodes created via this FS might stay read-only in the libkbfs NodeCache for a while.
func NewUnwrappedFS ¶
func NewUnwrappedFS(ctx context.Context, config libkbfs.Config, tlfHandle *tlfhandle.Handle, branch data.BranchName, subdir string, uniqID string, priority keybase1.MDPriority) (*FS, error)
NewUnwrappedFS returns a new FS instance, chroot'd to the given TLF and subdir within that TLF, but all the nodes are unwrapped. `subdir` must exist, and point to a directory, before this function is called. `uniqID` needs to uniquely identify this instance among all users of this TLF globally; for example, a device ID combined with a local tempfile name is recommended.
func (*FS) Chroot ¶
func (fs *FS) Chroot(p string) (newFS billy.Filesystem, err error)
Chroot implements the billy.Filesystem interface for FS.
func (*FS) ChrootAsLibFS ¶
ChrootAsLibFS returns a *FS whose root is p.
func (*FS) GetLockNamespace ¶
GetLockNamespace returns the namespace used in locking.
func (*FS) PathForLogging ¶
PathForLogging returns the obfuscated path for the given filename.
func (*FS) SetLockNamespace ¶
SetLockNamespace sets the namespace used in locking.
func (*FS) SubscribeToEvents ¶
SubscribeToEvents causes *File objects constructed from this *FS to send events to the channel at beginning of Lock and Unlock. The send is done blockingly so caller needs to drain the channel properly or make it buffered with enough size.
func (*FS) SubscribeToObsolete ¶
SubscribeToObsolete returns a channel that will be closed when this *FS reaches obsolescence, meaning if user of this object caches it for long term use, it should invalide this entry and create a new one using NewFS.
func (*FS) ToHTTPFileSystem ¶
func (fs *FS) ToHTTPFileSystem(ctx context.Context) http.FileSystem
ToHTTPFileSystem calls fs.WithCtx with ctx to create a *FS with the new ctx, and returns a wrapper around it that satisfies the http.FileSystem interface.
func (*FS) UnsubscribeToEvents ¶
UnsubscribeToEvents stops *File objects constructed from this *FS from sending events to ch. It also closes ch.
type FSEvent ¶
type FSEvent struct { EventType FSEventType File *File Done <-chan struct{} }
FSEvent is the type for events sent into the events channel passed into NewFS.
type FSEventType ¶
type FSEventType int
FSEventType is FS event type.
const ( // FSEventLock indicates Lock method has been called. FSEventLock FSEventType // FSEventUnlock indicates Unlock method has been called. FSEventUnlock )
type FSNotifications ¶
type FSNotifications struct {
// contains filtered or unexported fields
}
FSNotifications processes notifications (arbitrary functions, usually triggered by libkbfs) and lets other objects block on them, usually for testing.
func NewFSNotifications ¶
func NewFSNotifications(log logger.Logger) *FSNotifications
NewFSNotifications creates a new FSNotifications object.
func (*FSNotifications) LaunchProcessor ¶
func (f *FSNotifications) LaunchProcessor(ctx context.Context)
LaunchProcessor launches the notification processor.
func (*FSNotifications) QueueNotification ¶
func (f *FSNotifications) QueueNotification(fn func())
QueueNotification queues a notification, which must be goroutine-safe.
func (*FSNotifications) Wait ¶
func (f *FSNotifications) Wait()
Wait waits until all current notifications are done.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is a wrapper around a libkbfs.Node that implements the billy.File interface.
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo is a wrapper around libkbfs.EntryInfo that implements the os.FileInfo interface.
type FileInfoFast ¶
type FileInfoFast struct {
// contains filtered or unexported fields
}
FileInfoFast always returns a returns a read-only mode, and doesn't populate LastWriterUnverified. This allows us to avoid doing a Lookup on the entry, which makes a big difference in ReadDir.
func (*FileInfoFast) IsDir ¶
func (fif *FileInfoFast) IsDir() bool
IsDir implements the os.FileInfo interface.
func (*FileInfoFast) ModTime ¶
func (fif *FileInfoFast) ModTime() time.Time
ModTime implements the os.FileInfo interface.
func (*FileInfoFast) Mode ¶
func (fif *FileInfoFast) Mode() os.FileMode
Mode implements the os.FileInfo interface.
func (*FileInfoFast) Name ¶
func (fif *FileInfoFast) Name() string
Name implements the os.FileInfo interface.
func (*FileInfoFast) Size ¶
func (fif *FileInfoFast) Size() int64
Size implements the os.FileInfo interface.
func (*FileInfoFast) Sys ¶
func (fif *FileInfoFast) Sys() interface{}
Sys implements the os.FileInfo interface.
type JSONReportedError ¶
type JSONReportedError struct { Time time.Time Error string Stack []goerrors.StackFrame }
JSONReportedError stringifies the reported error before marshalling
type JournalAction ¶
type JournalAction int
JournalAction enumerates all the possible actions to take on a TLF's journal.
const ( // JournalEnable is to turn the journal on. JournalEnable JournalAction = iota // JournalFlush is to flush the journal. JournalFlush // JournalPauseBackgroundWork is to pause journal background // work. JournalPauseBackgroundWork // JournalResumeBackgroundWork is to resume journal background // work. JournalResumeBackgroundWork // JournalDisable is to disable the journal. JournalDisable // JournalEnableAuto is to turn on journals for all TLFs, persistently. JournalEnableAuto // JournalDisableAuto is to turn off automatic journaling for new TLFs. JournalDisableAuto )
func (JournalAction) Execute ¶
func (a JournalAction) Execute( ctx context.Context, jManager *libkbfs.JournalManager, tlfID tlf.ID, h *tlfhandle.Handle) error
Execute performs the action on the given JournalManager for the given TLF.
func (JournalAction) String ¶
func (a JournalAction) String() string
type KBFSMetadataForSimpleFS ¶
type KBFSMetadataForSimpleFS struct { LastWriter keybase1.User PrefetchStatus keybase1.PrefetchStatus PrefetchProgress libkbfs.PrefetchProgress }
KBFSMetadataForSimpleFS contains the KBFS metadata needed to answer a simpleFSStat call.
type KBFSMetadataForSimpleFSGetter ¶
type KBFSMetadataForSimpleFSGetter interface {
KBFSMetadataForSimpleFS() (KBFSMetadataForSimpleFS, error)
}
KBFSMetadataForSimpleFSGetter is an interface for something that can return the last KBFS writer and prefetch status of a directory entry.
type MountInterrupter ¶
type MountInterrupter struct { // can be locked from external code too. sync.Mutex // contains filtered or unexported fields }
MountInterrupter is for managing mounts with cancelation.
func NewMountInterrupter ¶
func NewMountInterrupter(log logger.Logger) *MountInterrupter
NewMountInterrupter creates a new MountInterrupter.
func (*MountInterrupter) Done ¶
func (mi *MountInterrupter) Done() error
Done signals Wait and runs the unmounter if set by MountAndSetUnmount. It can be called multiple times with no harm. Each call triggers a call to the unmounter.
func (*MountInterrupter) MountAndSetUnmount ¶
func (mi *MountInterrupter) MountAndSetUnmount(mounter Mounter) error
MountAndSetUnmount calls Mount and sets the unmount function to be called once if mount succeeds. If Done has already been called MountAndSetUnmount returns an error.
type Mounter ¶
type Mounter interface { // Mount a filesystem. Mount() error // Unmount a mounted filesystem. Unmount() error }
Mounter is the interface for filesystems to be mounted by MountInterrupter.
type PrevRevisionsGetter ¶
type PrevRevisionsGetter interface {
PrevRevisions() data.PrevRevisions
}
PrevRevisionsGetter is an interface for something that can return the previous revisions of an entry.
type RemoteStatus ¶
RemoteStatus is for maintaining status of various remote connections like keybase service and md-server.
func (*RemoteStatus) ExtraFileName ¶
func (r *RemoteStatus) ExtraFileName() string
ExtraFileName returns the extra file name or an empty string for none.
func (*RemoteStatus) ExtraFileNameAndSize ¶
func (r *RemoteStatus) ExtraFileNameAndSize() (string, int64)
ExtraFileNameAndSize returns the extra file name or an empty string for none and the size of the extra file.
func (*RemoteStatus) Init ¶
func (r *RemoteStatus) Init(ctx context.Context, log logger.Logger, config libkbfs.Config, rs RemoteStatusUpdater)
Init a RemoteStatus and register it with libkbfs.
func (*RemoteStatus) NewSpecialReadFunc ¶
NewSpecialReadFunc implements a special read file that contains human readable current status.
type RemoteStatusUpdater ¶
type RemoteStatusUpdater interface { // UserChanged is called when the kbfs user is changed. // Either oldName or newName, or both may be empty. UserChanged(ctx context.Context, oldName, newName kbname.NormalizedUsername) }
RemoteStatusUpdater has callbacks that will be called from libfs when kbfs status changes in interesting ways.
type RootFS ¶
type RootFS struct {
// contains filtered or unexported fields
}
RootFS is a browseable (read-only) version of `/keybase`. It does not support traversal into any subdirectories.
func (*RootFS) Chroot ¶
func (rfs *RootFS) Chroot(_ string) (newFS billy.Filesystem, err error)
Chroot implements the billy.Filesystem interface for RootFS.
func (*RootFS) ToHTTPFileSystem ¶
func (rfs *RootFS) ToHTTPFileSystem(ctx context.Context) http.FileSystem
ToHTTPFileSystem calls fs.WithCtx with ctx to create a *RootFS with the new ctx, and returns a wrapper around it that satisfies the http.FileSystem interface. ctx is ignored here.
type SyncAction ¶
type SyncAction int
SyncAction enumerates all the possible actions to take on a TLF's sync state.
const ( // SyncEnable is to enable syncing for a TLF. SyncEnable SyncAction = iota // SyncDisable is to disable syncing for a TLF. SyncDisable )
func (SyncAction) Execute ¶
func (a SyncAction) Execute( ctx context.Context, c libkbfs.Config, fb data.FolderBranch, h *tlfhandle.Handle) (err error)
Execute performs the action on the given JournalManager for the given TLF.
func (SyncAction) String ¶
func (a SyncAction) String() string
type TlfDoesNotExist ¶
type TlfDoesNotExist struct{}
TlfDoesNotExist is a shortcut error for the cases a TLF does not exist and an early successful exit via FilterTLFEarlyExitError is wished.
func (TlfDoesNotExist) Error ¶
func (TlfDoesNotExist) Error() string
Error - implement error interface.
Source Files ¶
- archive_util.go
- constants.go
- context.go
- error.go
- error_file.go
- file.go
- file_info.go
- file_info_file.go
- fs.go
- fs_notifications.go
- httpfs.go
- httprootfs.go
- journal_control_file.go
- json.go
- metrics_file.go
- mode.go
- mount_interrupter.go
- node_wrappers.go
- profilelist.go
- remote_status.go
- root_fs.go
- status_file.go
- sync_control_file.go
- time_equal.go
- tlf.go
- tlf_edit_history_file.go
- unstage_file.go
- update_history.go
- user_edit_history.go
- util.go
- wrapped_read_file.go
- wrapped_read_file_info.go