Documentation ¶
Overview ¶
Package fileresolver is a set of common resolvers for files used in olin.
These packages are dumb. This is intentional. The caller will handle all errors and massage them into the correct format with as little modification as possible on the resolver side.
Index ¶
- Variables
- func HTTP(cl *http.Client, u *url.URL) (abi.File, error)
- func Log(writer io.Writer, prefix string, flag int) abi.File
- func NewOSFile(fd uintptr, name string) abi.File
- func Null() abi.File
- func Random() abi.File
- func Reader(r io.Reader, name string) abi.File
- func Writer(w io.Writer, name string) abi.File
- func Zero() abi.File
- type OSFile
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotImplemented = errors.New("fileresolver: not implemeted")
)
Errors exposed by partial.go
Functions ¶
func HTTP ¶
HTTP creates a new HTTP transport that pretends to be a file. A process can (and should) have as many of these open as they need active HTTP connections. Users of this package are suggested to use the same underlying HTTP client as much as makes sense.
To use this file:
- write your request body to the file
- flush the file (this blocks for the duration of the HTTP request)
- read the response body from the file
- close the file when you are done reading the response
A new HTTP file will be required for every request on the guest side, but it will be for the best.
func Log ¶
Log returns a file that redirects all write calls to a standard library logger with the given prefix and flags.
For more information, please see the spec here: https://github.com/CommonWA/cwa-spec/blob/master/schemes/log.md
func NewOSFile ¶
NewOSFile creates a file backed by an OS file descriptor without buffering. This is kinda dangerous. Only do this if you know what you are doing.
func Null ¶
Null is a file that emulates /dev/null on Linux.
For more information, please see the spec here: https://github.com/CommonWA/cwa-spec/blob/master/schemes/null.md
func Zero ¶
Zero is a file that does nothing.
For more information, please see the spec here: https://github.com/CommonWA/cwa-spec/blob/master/schemes/zero.md