Documentation
¶
Index ¶
- Variables
- func CleanOldDeletedRepos(ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle) (err error)
- func CleanOldDeletedReposTimeLimited(ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle) error
- func DeleteRepo(ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, ...) error
- func GCRepo(ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, ...) (err error)
- func Init(ctx context.Context, gitKBFSParams libkbfs.InitParams, kbCtx libkbfs.Context, ...) (context.Context, libkbfs.Config, error)
- func LastGCTime(ctx context.Context, fs billy.Filesystem) (time.Time, error)
- func NeedsGC(storage storage.Storer, options GCOptions) (doPackRefs bool, numLooseRefs int, doPruneLoose bool, err error)
- func NewRPCHandlerWithCtx(kbCtx libkbfs.Context, config libkbfs.Config, ...) keybase1.KBFSGitInterface
- func Params(kbCtx libkbfs.Context, storageRoot string, paramsBase *libkbfs.InitParams) (params libkbfs.InitParams, tempDir string, err error)
- func RenameRepo(ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, ...) (err error)
- func UpdateRepoMD(ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, ...) error
- type Config
- type GCOptions
- type GitConfigWithoutRemotesStorer
- type ID
- func CreateRepoAndID(ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, ...) (ID, error)
- func GetOrCreateRepoAndID(ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, ...) (*libfs.FS, ID, error)
- func GetRepoAndID(ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, ...) (*libfs.FS, ID, error)
- type InvalidIDError
- type RPCHandler
Constants ¶
This section is empty.
Variables ¶
var NullID = ID{}
NullID is an empty ID
Functions ¶
func CleanOldDeletedRepos ¶
func CleanOldDeletedRepos( ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle) (err error)
CleanOldDeletedRepos completely removes any "deleted" repos that have been deleted for longer than `minDeletedAgeForCleaning`. The caller is responsible for syncing any data to disk, if desired.
func CleanOldDeletedReposTimeLimited ¶
func CleanOldDeletedReposTimeLimited( ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle) error
CleanOldDeletedReposTimeLimited is the same as `CleanOldDeletedRepos`, except it limits the time spent on cleaning, deleting as much data as possible within the given time limit (without returning an error).
func DeleteRepo ¶
func DeleteRepo( ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, repoName string) error
DeleteRepo "deletes" the given repo in the given TLF. Right now it simply moves the repo out of the way to a special directory, to allow any concurrent writers to finish their pushes without triggering conflict resolution. The caller is responsible for syncing the FS and flushing the journal, if desired. It expects the `config` object to be unique during the lifetime of this call.
func GCRepo ¶
func GCRepo( ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, repoName string, options GCOptions) (err error)
GCRepo runs garbage collection on the specified repo, if it exceeds any of the thresholds provided in `options`.
func Init ¶
func Init(ctx context.Context, gitKBFSParams libkbfs.InitParams, kbCtx libkbfs.Context, keybaseServiceCn libkbfs.KeybaseServiceCn, defaultLogPath string) (context.Context, libkbfs.Config, error)
Init initializes a context and a libkbfs.Config for git operations. The config should be shutdown when it is done being used.
func LastGCTime ¶
LastGCTime returns the last time the repo was successfully garbage-collected.
func NeedsGC ¶
func NeedsGC(storage storage.Storer, options GCOptions) ( doPackRefs bool, numLooseRefs int, doPruneLoose bool, err error)
NeedsGC checks the given repo storage layer against the given options to see what kinds of GC are needed on the repo.
func NewRPCHandlerWithCtx ¶
func NewRPCHandlerWithCtx(kbCtx libkbfs.Context, config libkbfs.Config, kbfsInitParams *libkbfs.InitParams) keybase1.KBFSGitInterface
NewRPCHandlerWithCtx returns a new instance of a Git RPC handler.
func Params ¶
func Params(kbCtx libkbfs.Context, storageRoot string, paramsBase *libkbfs.InitParams) ( params libkbfs.InitParams, tempDir string, err error)
Params returns a set of default parameters for git-related operations, along with a temp directory that should be cleaned after the git work is complete.
func RenameRepo ¶
func RenameRepo( ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, oldRepoName, newRepoName string) (err error)
RenameRepo renames the repo from an old name to a new name. It leaves a symlink behind so that old remotes will continue to work. The caller is responsible for syncing the FS and flushing the journal, if desired.
Types ¶
type Config ¶
type Config struct {
ID ID
Name string // the original user-supplied format of the name
CreatorUID string
Ctime int64 // create time in unix nanoseconds, by creator's clock
}
Config is a KBFS git repo config file.
type GCOptions ¶
type GCOptions struct {
// The most loose refs we will tolerate; if there are more loose
// refs, we should pack them.
MaxLooseRefs int
// The minimum number of potentially-expired loose objects we need
// to start the pruning process. If < 0, pruning will not be done.
PruneMinLooseObjects int
// Any unreachable objects older than this time are subject to
// pruning.
PruneExpireTime time.Time
}
GCOptions describe options foe garbage collection.
type GitConfigWithoutRemotesStorer ¶
type GitConfigWithoutRemotesStorer struct {
*filesystem.Storage
// contains filtered or unexported fields
}
GitConfigWithoutRemotesStorer strips remotes from the config before writing them to disk, to work around a gcfg bug (used by go-git when reading configs from disk) that causes a freakout when it sees backslashes in git file URLs.
func NewGitConfigWithoutRemotesStorer ¶
func NewGitConfigWithoutRemotesStorer(fs *libfs.FS) ( *GitConfigWithoutRemotesStorer, error)
NewGitConfigWithoutRemotesStorer creates a new git config implementation that strips remotes from the config before writing them to disk.
func (*GitConfigWithoutRemotesStorer) Config ¶
func (cwrs *GitConfigWithoutRemotesStorer) Config() (*gogitcfg.Config, error)
Config implements the `storer.Storer` interface.
func (*GitConfigWithoutRemotesStorer) Init ¶
func (cwrs *GitConfigWithoutRemotesStorer) Init() error
Init implements the `storer.Initializer` interface.
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID encapsulates a repo ID.
func CreateRepoAndID ¶
func CreateRepoAndID( ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, repoName string) (ID, error)
CreateRepoAndID returns a new stable repo ID for the provided repoName in the given TLF. If the repo has already been created, it returns a `RepoAlreadyExistsError`. If `repoName` already exists, but is a symlink to another renamed directory, the symlink will be removed in favor of the new repo. The caller is responsible for syncing the FS and flushing the journal, if desired. It expects the `config` object to be unique during the lifetime of this call.
func GetOrCreateRepoAndID ¶
func GetOrCreateRepoAndID( ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, repoName string, uniqID string) (*libfs.FS, ID, error)
GetOrCreateRepoAndID returns a filesystem object rooted at the specified repo, along with the stable repo ID. If the repo hasn't been created yet, it generates a new ID and creates the repo. The caller is responsible for syncing the FS and flushing the journal, if desired.
func GetRepoAndID ¶
func GetRepoAndID( ctx context.Context, config libkbfs.Config, tlfHandle *libkbfs.TlfHandle, repoName string, uniqID string) (*libfs.FS, ID, error)
GetRepoAndID returns a filesystem object rooted at the specified repo, along with the stable repo ID, if it already exists.
func (ID) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for ID.
func (ID) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for ID.
func (*ID) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for ID.
func (*ID) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for ID.
type InvalidIDError ¶
type InvalidIDError struct {
// contains filtered or unexported fields
}
InvalidIDError indicates that a repo ID string is not parseable or invalid.
func (InvalidIDError) Error ¶
func (e InvalidIDError) Error() string
type RPCHandler ¶
type RPCHandler struct {
// contains filtered or unexported fields
}
RPCHandler handles service->KBFS git RPC calls.
func (*RPCHandler) CreateRepo ¶
func (rh *RPCHandler) CreateRepo( ctx context.Context, arg keybase1.CreateRepoArg) ( id keybase1.RepoID, err error)
CreateRepo implements keybase1.KBFSGitInterface for KeybaseServiceBase.
func (*RPCHandler) DeleteRepo ¶
func (rh *RPCHandler) DeleteRepo( ctx context.Context, arg keybase1.DeleteRepoArg) (err error)
DeleteRepo implements keybase1.KBFSGitInterface for KeybaseServiceBase.