zntg/ui/resources.go

20 lines
684 B
Go
Raw Permalink Normal View History

2020-05-15 12:20:07 +00:00
package ui
import "io"
// Resources is an abstraction for opening resources.
2020-05-15 12:20:07 +00:00
type Resources interface {
// OpenResource should open the resource with the specified name. The user is responsible for closing the resource.
OpenResource(name string) (io.ReadCloser, error)
// Destroy can be used for cleaning up at the end of the applications lifetime.
Destroy() error
}
// PhysicalResources is an abstraction for opening and fetching (to disk) resources.
type PhysicalResources interface {
Resources
// FetchResource should fetch the resource with the specified name and return a path (on disk) where the resource can be accessed.
FetchResource(name string) (string, error)
}