Documentation ¶
Index ¶
Constants ¶
const PathDepthLimit = 2
PathDepthLimit specifies how many nested directories are searched for resources.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Release ¶
type Release interface { // HasResource returns true for a unique resource name if the release contains this resource. HasResource(name string) bool // GetResource returns the resource identified by given name if existing, or an error otherwise. GetResource(name string) (Resource, error) // NewResource creates a new resource under given path and returns the instance, or an error on failure. NewResource(name string, path string) (Resource, error) }
Release wraps a set of unique resources that together make up one release.
func FromAbsolutePaths ¶
FromAbsolutePaths returns a Release that provides resources exclusively from the provided paths.
func NewMemoryRelease ¶
func NewMemoryRelease() Release
NewMemoryRelease returns a Release instance that keeps all resources and their data in memory.
func ReleaseFromDir ¶
ReleaseFromDir returns a release instance if the given path specifies an existing directory.
type ReleaseContainer ¶
type ReleaseContainer interface { // Names returns the list of currently known releases. Names() []string // Get returns the release with given name, or an error if not possible. Get(name string) (Release, error) // New creates a new release with given name and returns it, or an error if not possible. New(name string) (Release, error) }
ReleaseContainer can contain any number of releases and provides access to them.
func NewContainerFromDir ¶
func NewContainerFromDir(path string) (container ReleaseContainer, err error)
NewContainerFromDir returns a release container for given file path. An error is returned if the specified directory doesn't exist or any other problem occurred.
func NewMemoryReleaseContainer ¶
func NewMemoryReleaseContainer() ReleaseContainer
NewMemoryReleaseContainer returns a ReleaseContainer for releases only in memory.
func NewStaticReleaseContainer ¶
func NewStaticReleaseContainer(releases map[string]Release) ReleaseContainer
NewStaticReleaseContainer returns a new instance of a ReleaseContainer.
type Resource ¶
type Resource interface { // Name returns the unique identifier - the file name of the resource. Name() string // Path returns the (relative) path for the resource, based on the release's root. Path() string // AsSource returns an interface for reading the resource. AsSource() (serial.SeekingReadCloser, error) // AsSink returns an interface for writing the resource. AsSink() (serial.SeekingWriteCloser, error) }
Resource describes one resource file.
type StaticReleaseContainer ¶
type StaticReleaseContainer struct {
// contains filtered or unexported fields
}
StaticReleaseContainer is not capable of creating new releases. It provides only the initially registered releases.
func (*StaticReleaseContainer) Get ¶
func (container *StaticReleaseContainer) Get(name string) (rel Release, err error)
Get implements the ReleaseContainer interface
func (*StaticReleaseContainer) Names ¶
func (container *StaticReleaseContainer) Names() []string
Names implements the ReleaseContainer interface