2020-05-15 12:20:07 +00:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import "io"
|
|
|
|
|
2020-05-25 20:24:06 +00:00
|
|
|
// 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
|
|
|
|
}
|
2020-05-25 20:24:06 +00:00
|
|
|
|
|
|
|
// 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)
|
|
|
|
}
|