Documentation ¶
Index ¶
- func WithReference(ref plumbing.ReferenceName) containers.Option[Options]
- type Dir
- type DirEntry
- type FS
- func New(logger *zap.Logger, storage storage.Storer, tree *object.Tree) FS
- func NewFromRepo(logger *zap.Logger, repo *git.Repository, opts ...containers.Option[Options]) (FS, error)
- func NewFromRepoHash(logger *zap.Logger, repo *git.Repository, hash plumbing.Hash) (FS, error)
- func NewFromRepoHashString(logger *zap.Logger, repo *git.Repository, hash string) (FS, error)
- type File
- type FileInfo
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithReference ¶
func WithReference(ref plumbing.ReferenceName) containers.Option[Options]
WithReference overrides the default reference to main.
Types ¶
type Dir ¶
type Dir struct {
// contains filtered or unexported fields
}
Dir is a representation of a directory found within a filesystem. The contents of the directory can be listed and accessed via the ReadDir method. It is an implementation of fs.File.
func (*Dir) ReadDir ¶
ReadDir reads the contents of the directory and returns a slice of up to n DirEntry values in directory order. Subsequent calls on the same file will yield further DirEntry values.
If n > 0, ReadDir returns at most n DirEntry structures. In this case, if ReadDir returns an empty slice, it will return a non-nil error explaining why. At the end of a directory, the error is io.EOF. (ReadDir must return io.EOF itself, not an error wrapping io.EOF.)
If n <= 0, ReadDir returns all the DirEntry values from the directory in a single slice. In this case, if ReadDir succeeds (reads all the way to the end of the directory), it returns the slice and a nil error. If it encounters an error before the end of the directory, ReadDir returns the DirEntry list read until that point and a non-nil error.
type DirEntry ¶
type DirEntry struct {
// contains filtered or unexported fields
}
DirEntry represents an entry within a file system directory. The entry could itself be a directory or another type of file.
func (DirEntry) Info ¶
Info returns the FileInfo for the file or subdirectory described by the entry. The returned FileInfo may be from the time of the original directory read or from the time of the call to Info. If the file has been removed or renamed since the directory read, Info may return an error satisfying errors.Is(err, ErrNotExist). If the entry denotes a symbolic link, Info reports the information about the link itself, not the link's target.
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS is a filesystem implementation that decorates a git storage implementation and instance of a git tree. FS implements fs.FS and is therefore read-only by design.
func New ¶
New instantiates and instance of storage which retrieves files from the provided storage.Storer implementation and instance of *object.Tree.
func NewFromRepo ¶
func NewFromRepo(logger *zap.Logger, repo *git.Repository, opts ...containers.Option[Options]) (FS, error)
NewFromRepo is a convenience utility which constructs an instance of FS from the provided git repository. By default the returned FS serves the content from the root tree for the commit at reference HEAD.
func NewFromRepoHash ¶
NewFromRepoHash is a convenience utility which constructs an instance of FS from the provided git repository and hash.
func NewFromRepoHashString ¶
NewFromRepoHash is a convenience utility which constructs an instance of FS from the provided git repository and hash string.
func (FS) Open ¶
Open opens the named file. When Open returns an error, it should be of type *PathError with the Op field set to "open", the Path field set to name, and the Err field describing the problem.
Open should reject attempts to open names that do not satisfy ValidPath(name), returning a *PathError with Err set to ErrInvalid or ErrNotExist.
type File ¶
type File struct { io.ReadCloser // contains filtered or unexported fields }
File is a representation of a file which can be read.