-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pkg/controller): add fs config structure
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
} |