roghfs

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 12 Imported by: 0

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

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 New

func New(c Config) *Roghfs

func (*Roghfs) Chmod

func (r *Roghfs) Chmod(_ string, _ os.FileMode) error

Chmod does nothing but returning the error syscall.EPERM.

func (*Roghfs) Chown

func (r *Roghfs) Chown(_ string, _ int, _ int) error

Chown does nothing but returning the error syscall.EPERM.

func (*Roghfs) Chtimes

func (r *Roghfs) Chtimes(n string, _ time.Time, _ time.Time) error

Chtimes does nothing but returning the error syscall.EPERM.

func (*Roghfs) Create

func (r *Roghfs) Create(_ string) (afero.File, error)

Create does nothing but returning the error syscall.EPERM.

func (*Roghfs) Mkdir

func (r *Roghfs) Mkdir(_ string, _ os.FileMode) error

Mkdir does nothing but returning the error syscall.EPERM.

func (*Roghfs) MkdirAll

func (r *Roghfs) MkdirAll(_ string, _ os.FileMode) error

MkdirAll does nothing but returning the error syscall.EPERM.

func (*Roghfs) Name

func (r *Roghfs) Name() string

func (*Roghfs) Open

func (r *Roghfs) Open(pat string) (afero.File, error)

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

func (r *Roghfs) OpenFile(pat string, flg int, prm os.FileMode) (afero.File, error)

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) Remove

func (r *Roghfs) Remove(_ string) error

Remove does nothing but returning the error syscall.EPERM.

func (*Roghfs) RemoveAll

func (r *Roghfs) RemoveAll(_ string) error

RemoveAll does nothing but returning the error syscall.EPERM.

func (*Roghfs) Rename

func (r *Roghfs) Rename(_ string, _ string) error

Rename does nothing but returning the error syscall.EPERM.

func (*Roghfs) Stat

func (r *Roghfs) Stat(pat string) (os.FileInfo, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL