Documentation ¶
Overview ¶
Package repository implements services to work with Git repository storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrCopyCancelled = errors.NewKind("copy was cancelled")
ErrCopyCancelled is returned when a copy is cancelled.
var HDFSNamenodeError = errors.NewKind("HDFS namenode error")
HDFSNamenodeError is returned when there is a namenode error.
Functions ¶
This section is empty.
Types ¶
type Copier ¶
type Copier struct {
// contains filtered or unexported fields
}
Copier is in charge of copying files from a local filesystem to the remote one and vice-versa. It can optionally bucket files on the remote filesystem.
func (*Copier) CopyFromRemote ¶
CopyFromRemote copies a file to the local filesystem from the remote one.
func (*Copier) CopyToRemote ¶
CopyToRemote copies a file from the local filesystem to the remote one.
type Fs ¶
type Fs interface { // Open a file reader. Open(string) (io.ReadCloser, error) // WriteTo a file. It returns a file writer. WriteTo(string) (io.WriteCloser, error) // Rename atomically a file from one path to another. Rename(src, dst string) error // DeleteIfExists deletes a file only if it exists. DeleteIfExists(string) error // Base returns the base path of the filesystem to write files to. Base() string }
Fs is a filesystem implementation that has some operations such as opening files, opening file writers, renaming, etc.
type RootedTransactioner ¶
RootedTransactioner can initiate transactions on rooted repositories.
func NewSivaRootedTransactioner ¶
func NewSivaRootedTransactioner(copier *Copier) RootedTransactioner
NewSivaRootedTransactioner returns a RootedTransactioner for repositories stored in the given billy.Filesystem (using siva file format), and uses a second billy.Filesystem as temporary storage for in-progress transactions.
Note that transactionality is not fully guaranteed by this implementation, since it relies on copying between arbitrary filesystems. If a Commit operation fails, the state of the first filesystem is unknown and can be invalid.
func NewSivaRootedTransactionerWithCache ¶
func NewSivaRootedTransactionerWithCache( copier *Copier, c cache.Object, ) RootedTransactioner
NewSivaRootedTransactionerWithCache creates a new RootedTransactioner where you can specify its cache.
type Tx ¶
type Tx interface { // Storer gets the repository storer. It returns the same instance on // every call until Commit or Rollback is performed. Storer() storage.Storer // Commit commits all changes to the repository. Commit(context.Context) error // Rollback undoes any changes and cleans up. Rollback() error }
Tx is a transaction on a repository. Any change performed in the given repository storer is in a transaction context. Transactions are guaranteed to be isolated.