Documentation
¶
Index ¶
- func New() (sdk.StorageService, error)
- func NewWithStorageDriver(driver StorageDriver) (sdk.StorageService, error)
- type DefaultStorageDriver
- func (s *DefaultStorageDriver) DeleteFile(file string) error
- func (s *DefaultStorageDriver) EnsureDirExists(dir string) error
- func (s *DefaultStorageDriver) ExistsOrFail(path string) error
- func (s *DefaultStorageDriver) ReadFile(file string) ([]byte, error)
- func (s *DefaultStorageDriver) WriteFile(file string, contents []byte, fileMode os.FileMode) error
- type LocalStorageService
- type StorageDriver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWithStorageDriver ¶
func NewWithStorageDriver(driver StorageDriver) (sdk.StorageService, error)
NewWithStorageDriver creates a new StorageService with the given StorageDriver primarily used for mock testing
Types ¶
type DefaultStorageDriver ¶
type DefaultStorageDriver struct {
}
DefaultStorageDriver - The Storage Driver to be used when creating a new Local Storage Plugin using the New() method
func (*DefaultStorageDriver) DeleteFile ¶
func (s *DefaultStorageDriver) DeleteFile(file string) error
DeleteFile - Deletes the file at the given path
func (*DefaultStorageDriver) EnsureDirExists ¶
func (s *DefaultStorageDriver) EnsureDirExists(dir string) error
EnsureDirExists - Recursively creates directories for the given path
func (*DefaultStorageDriver) ExistsOrFail ¶
func (s *DefaultStorageDriver) ExistsOrFail(path string) error
ExistsOrFail - Returns an error if the provided path doesn't exist in the file system
type LocalStorageService ¶
type LocalStorageService struct {
// contains filtered or unexported fields
}
LocalStorageService - The Nitric Storage Plugin for local development work Primarily used as part of the nitric run CLI function
func (*LocalStorageService) Delete ¶
func (s *LocalStorageService) Delete(bucket string, key string) error
Delete - deletes an item from Storage
type StorageDriver ¶
type StorageDriver interface {
EnsureDirExists(string) error
ExistsOrFail(string) error
WriteFile(string, []byte, os.FileMode) error
ReadFile(string) ([]byte, error)
DeleteFile(string) error
}
StorageDriver - The interface used by the LocalStorage plugin to write/read files from the local file system