Documentation
¶
Overview ¶
Package filestore contains a simple and minimal abstraction over OS operations for reading and writing to files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cached ¶
type Cached struct { Dir string // contains filtered or unexported fields }
Cached is a FileStore that uses the OS' file system, but adds in-memory caching in between. The files are never written to disk until the Cached.Flush or [FileStore.Close] method is called.
type FileStore ¶
type FileStore interface { ReadFile(path string) ([]byte, error) WriteFile(path string, content []byte) error Close() error }
FileStore is a minimal abstraction over reading and writing files that is used in the patching steps (e.g yaml patch, regex patch, etc).
This abstraction allows us to mock the filesystem during testing, as well as adding additional features like caching when you have multiple patches on the same file (see Cached).
type TestFileStore ¶
type TestFileStore struct {
// contains filtered or unexported fields
}
TestFileStore is a FileStore used during Go unit tests. It never touches the OS' underlying file system.
func NewTestFileStore ¶
func NewTestFileStore(files map[string]string) *TestFileStore
func (*TestFileStore) Close ¶
func (s *TestFileStore) Close() error