Skip to content

Commit

Permalink
feat(pkg/controller): add fs config structure
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeMac committed Jul 21, 2023
1 parent a048a3a commit c73e021
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/controller/fs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package controller

import "io/fs"

// FSConfig encapsulates the configuration required to establish the root
// directory of the wazero runtime when performing controller actions.
type FSConfig struct {
fs fs.FS
dir *string
}

// NewFSConfig constructs an FSConfig which wraps an implementation of fs.FS (read-only).
func NewFSConfig(fs fs.FS) FSConfig {
return FSConfig{fs: fs}
}

// NewDirFSConfig constructs an FSConfig which idenitifes a target directory on disk
// to be leveraged when mounting the wazero FS (currently to support writes).
func NewDirFSConfig(dir string) FSConfig {
return FSConfig{
dir: &dir,
}
}

0 comments on commit c73e021

Please sign in to comment.