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 ¶
- 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 ¶
This section is empty.
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
// Org is the name of the Github organization that owns the repository to read
// from.
Org string
// Rep is the name of the Github repository to read from.
Rep string
// Ref is the Git specific branch, tag, or commit. The reserved value "HEAD"
// can be provided for the latest commit.
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. If the given file does not exist, an os.PathError is returned.