Documentation
¶
Overview ¶
Package roghfs implements a read-only afero.Fs for remote Github repositories. If you do not trust the read-only guarantees of this implementation, then you can wrap it in afero's own read-only interface via afero.NewReadOnlyFs(). Roghfs fetches the remote source files from the configured remote Github repository on first file system read, and delegates all further I/O operations to the injected base file system, e.g. afero.NewMemMapFs().
Index ¶
- func IsFileAlreadyCached(err error) bool
- func IsInvalidRepositoryUrl(err error) bool
- func Parse(str string) (string, string, error)
- type Config
- type Roghfs
- func (r *Roghfs) Chmod(_ string, _ os.FileMode) error
- func (r *Roghfs) Chown(_ string, _ int, _ int) error
- func (r *Roghfs) Chtimes(n string, _ time.Time, _ time.Time) error
- func (r *Roghfs) Create(_ string) (afero.File, error)
- func (r *Roghfs) Mkdir(_ string, _ os.FileMode) error
- func (r *Roghfs) MkdirAll(_ string, _ os.FileMode) error
- func (r *Roghfs) Name() string
- func (r *Roghfs) Open(pat string) (afero.File, error)
- func (r *Roghfs) OpenFile(pat string, flg int, prm os.FileMode) (afero.File, error)
- func (r *Roghfs) Remove(_ string) error
- func (r *Roghfs) RemoveAll(_ string) error
- func (r *Roghfs) Rename(_ string, _ string) error
- func (r *Roghfs) Stat(pat string) (os.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsFileAlreadyCached ¶
func IsInvalidRepositoryUrl ¶
Types ¶
type Config ¶
type Config struct {
// Bas is the interface for the base file system that all repository source
// files are written to.
Bas afero.Fs
// Git is the authenticated Github client used to access the configured
// repository source files.
Git *github.Client
// Own is the name of the Github organization that owns the repository to read
// from.
Own string
// Rep is the name of the Github repository to read from.
Rep string
// Ref is the Git specific release tag or commit sha, in order to guarantee
// consistent file system reads across time. Branch names are invalid, and the
// reserved value "HEAD" must not be provided either, because those transitive
// references may point to changing tree states eventually.
Ref string
}
type Roghfs ¶
type Roghfs struct {
// contains filtered or unexported fields
}
func (*Roghfs) Open ¶
Open tries to open the given file. Note that Open() is called after every walk function loop for directories when using afero.Walk().
func (*Roghfs) OpenFile ¶
OpenFile opens a file using the given flags and the given permissions. The error syscall.EPERM is returned if the provided flags request any form of write access.
func (*Roghfs) Stat ¶
Stat tries to return an instance of os.FileInfo for the given file path. Note that Stat is called before every loop of the walk function of afero.Walk, because Stat provides the fs.FileInfo instance for every walk function call. The first call of Stat will also setup the entire file and folder structure within the underlying base file system. If the given file does not exist after all, an os.PathError is returned.