Documentation ¶
Index ¶
- Constants
- Variables
- func Main(def exec.ModuleDefinition)
- func MainErr(def exec.ModuleDefinition) error
- func NewModuleEventHandler(options *Options) exec.ModuleEventHandler
- func Pread(r io.ReaderAt, buffers [][]byte, offset int64) (uint32, error)
- func Pwrite(w io.WriterAt, buffers [][]byte, offset int64) (uint32, error)
- func Readv(r io.Reader, buffers [][]byte) (uint32, error)
- func Run(name string, def exec.ModuleDefinition, runOptions *RunOptions) error
- func Writev(w io.Writer, buffers [][]byte) (uint32, error)
- type Directory
- type ErrFile
- func (ErrFile) Advise(offset, length uint64, advice int) error
- func (ErrFile) Close() error
- func (ErrFile) Datasync() error
- func (ErrFile) Pread(buffers [][]byte, offset int64) (uint32, error)
- func (ErrFile) Pwrite(buffers [][]byte, offset int64) (uint32, error)
- func (ErrFile) Readv(buffers [][]byte) (uint32, error)
- func (ErrFile) Seek(offset int64, whence int) (int64, error)
- func (ErrFile) SetFlags(flags int) error
- func (ErrFile) SetSize(size uint64) error
- func (ErrFile) SetTimes(accessTime *time.Time, modTime *time.Time) error
- func (ErrFile) Stat() (FDStat, error)
- func (ErrFile) Sync() error
- func (ErrFile) Writev(buffers [][]byte) (uint32, error)
- type Event
- type ExitError
- type FDStat
- type FS
- type File
- type FileStat
- type Options
- type Preopen
- type Resolver
- type Rights
- type RunOptions
- type Subscription
- type TrapExit
Constants ¶
View Source
const ( // The application has no advice to give on its behavior with respect to the specified data. AdviceNormal = wasiAdviceNormal // The application expects to access the specified data sequentially from lower offsets to higher offsets. AdviceSequential = wasiAdviceSequential // The application expects to access the specified data in a random order. AdviceRandom = wasiAdviceRandom // The application expects to access the specified data in the near future. AdviceWillneed = wasiAdviceWillneed // The application expects that it will not access the specified data in the near future. AdviceDontneed = wasiAdviceDontneed // The application expects to access the specified data once and then not reuse it thereafter. AdviceNoreuse = wasiAdviceNoreuse // Append mode: Data written to the file is always appended to the file's end. F_Append = wasiFdflagsAppend // Write according to synchronized I/O data integrity completion. Only the data stored in the file is synchronized. F_Dsync = wasiFdflagsDsync // Non-blocking mode. F_Nonblock = wasiFdflagsNonblock // Synchronized read I/O operations. F_Rsync = wasiFdflagsRsync // Write according to synchronized I/O file integrity completion. In // addition to synchronizing the data stored in the file, the implementation // may also synchronously update the file's metadata. F_Sync = wasiFdflagsSync // Create file if it does not exist. O_Create = wasiOflagsCreat // Fail if not a directory. O_Directory = wasiOflagsDirectory // Fail if file already exists. O_Excl = wasiOflagsExcl // Truncate file to size 0. O_Trunc = wasiOflagsTrunc // The given timeout has expired or deadline has been reached. SubscriptionTimer = 0 // The given file has data available for reading. SubscriptionRead = 1 // The given file has data available for writing. SubscriptionWrite = 2 // The peer of this socket has closed or disconnected. EventHangup = wasiEventrwflagsFdReadwriteHangup // ErrnoIO indicates that an I/O error occurred during Poll. ErrnoIO = wasiErrnoIo )
View Source
const ( FileRights = RightsFdAdvise | RightsFdAllocate | RightsFdDatasync | RightsFdFdstatSetFlags | RightsFdFilestatGet | RightsFdFilestatSetSize | RightsFdFilestatSetTimes | RightsFdRead | RightsFdSeek | RightsFdSync | RightsFdTell | RightsFdWrite | RightsPollFdReadwrite | RightsSockShutdown DirectoryRights = RightsFdReaddir | RightsPathCreateDirectory | RightsPathCreateFile | RightsPathFilestatGet | RightsPathFilestatSetSize | RightsPathFilestatSetTimes | RightsPathLinkSource | RightsPathLinkTarget | RightsPathOpen | RightsPathReadlink | RightsPathRemoveDirectory | RightsPathRenameSource | RightsPathRenameTarget | RightsPathSymlink | RightsPathUnlinkFile AllRights = FileRights | DirectoryRights ReadOnlyRights = RightsFdRead | RightsFdSeek | RightsFdTell | RightsFdAdvise | RightsPathOpen | RightsFdReaddir | RightsPathReadlink | RightsPathFilestatGet | RightsFdFilestatGet | RightsPollFdReadwrite // The right to invoke `fd_datasync`. // If `path_open` is set, includes the right to invoke // `path_open` with `fdflags::dsync`. RightsFdDatasync = 1 << 0 // The right to invoke `fd_read` and `sock_recv`. // If `rights::fd_seek` is set, includes the right to invoke `fd_pread`. RightsFdRead = 1 << 1 // The right to invoke `fd_seek`. This flag implies `rights::fd_tell`. RightsFdSeek = 1 << 2 // The right to invoke `fd_fdstat_set_flags`. RightsFdFdstatSetFlags = 1 << 3 // The right to invoke `fd_sync`. // If `path_open` is set, includes the right to invoke // `path_open` with `fdflags::rsync` and `fdflags::dsync`. RightsFdSync = 1 << 4 // The right to invoke `fd_seek` in such a way that the file offset // remains unaltered (i.e., `whence::cur` with offset zero), or to // invoke `fd_tell`. RightsFdTell = 1 << 5 // The right to invoke `fd_write` and `sock_send`. // If `rights::fd_seek` is set, includes the right to invoke `fd_pwrite`. RightsFdWrite = 1 << 6 // The right to invoke `fd_advise`. RightsFdAdvise = 1 << 7 // The right to invoke `fd_allocate`. RightsFdAllocate = 1 << 8 // The right to invoke `path_create_directory`. RightsPathCreateDirectory = 1 << 9 // If `path_open` is set, the right to invoke `path_open` with `oflags::creat`. RightsPathCreateFile = 1 << 10 // The right to invoke `path_link` with the file descriptor as the // source directory. RightsPathLinkSource = 1 << 11 // The right to invoke `path_link` with the file descriptor as the // target directory. RightsPathLinkTarget = 1 << 12 // The right to invoke `path_open`. RightsPathOpen = 1 << 13 // The right to invoke `fd_readdir`. RightsFdReaddir = 1 << 14 // The right to invoke `path_readlink`. RightsPathReadlink = 1 << 15 // The right to invoke `path_rename` with the file descriptor as the source directory. RightsPathRenameSource = 1 << 16 // The right to invoke `path_rename` with the file descriptor as the target directory. RightsPathRenameTarget = 1 << 17 // The right to invoke `path_filestat_get`. RightsPathFilestatGet = 1 << 18 // The right to change a file's size (there is no `path_filestat_set_size`). // If `path_open` is set, includes the right to invoke `path_open` with `oflags::trunc`. RightsPathFilestatSetSize = 1 << 19 // The right to invoke `path_filestat_set_times`. RightsPathFilestatSetTimes = 1 << 20 // The right to invoke `fd_filestat_get`. RightsFdFilestatGet = 1 << 21 // The right to invoke `fd_filestat_set_size`. RightsFdFilestatSetSize = 1 << 22 // The right to invoke `fd_filestat_set_times`. RightsFdFilestatSetTimes = 1 << 23 // The right to invoke `path_symlink`. RightsPathSymlink = 1 << 24 // The right to invoke `path_remove_directory`. RightsPathRemoveDirectory = 1 << 25 // The right to invoke `path_unlink_file`. RightsPathUnlinkFile = 1 << 26 // If `rights::fd_read` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_read`. // If `rights::fd_write` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_write`. RightsPollFdReadwrite = 1 << 27 // The right to invoke `sock_shutdown`. RightsSockShutdown = 1 << 28 )
Variables ¶
View Source
var SnapshotPreview1 exec.ModuleDefinition = wasiSnapshotPreview1Definition(0)
SnapshotPreview1 is the definition for the module canonically named "wasi_snapshot_preview1".
Functions ¶
func Main ¶
func Main(def exec.ModuleDefinition)
func MainErr ¶
func MainErr(def exec.ModuleDefinition) error
func NewModuleEventHandler ¶
func NewModuleEventHandler(options *Options) exec.ModuleEventHandler
func Run ¶
func Run(name string, def exec.ModuleDefinition, runOptions *RunOptions) error
Types ¶
type Directory ¶
type Directory interface { File FileStat(path string, followSymlinks bool) (FileStat, error) Mkdir(path string) error Open(path string, oflags, fflags int) (File, error) ReadDir(n int) ([]os.DirEntry, error) ReadLink(path string) (string, error) Rmdir(path string) error SetFileTimes(path string, accessTime *time.Time, modTime *time.Time, followSymlinks bool) error UnlinkFile(path string) error }
type FS ¶
type FS interface { OpenDirectory(path string) (Directory, error) Link(sourceDir Directory, sourceName string, targetDir Directory, targetName string) error Poll(subscriptions []Subscription) ([]Event, error) Rename(sourceDir Directory, sourceName string, targetDir Directory, targetName string) error Symlink(sourceDir Directory, sourceName string, targetDir Directory, targetName string) error }
type File ¶
type File interface { Advise(offset, length uint64, advice int) error Close() error Datasync() error Pread(buffers [][]byte, offset int64) (uint32, error) Pwrite(buffers [][]byte, offset int64) (uint32, error) Readv(buffers [][]byte) (uint32, error) Seek(offset int64, whence int) (int64, error) SetFlags(flags int) error SetSize(size uint64) error SetTimes(accessTime *time.Time, modTime *time.Time) error Stat() (FDStat, error) Sync() error Writev(buffers [][]byte) (uint32, error) }
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver(inner exec.ModuleResolver) Resolver
func (Resolver) ResolveModule ¶
func (r Resolver) ResolveModule(name string) (exec.ModuleDefinition, error)
type RunOptions ¶
type Subscription ¶
Click to show internal directories.
Click to hide internal directories.