Documentation
¶
Index ¶
Constants ¶
View Source
const ( Context = ContextStorage("storage") // Cloud Specific const CloudType = "cloud_type" BucketName = "bucket_name" Prefix = "prefix" Custom = "custom" AccessId = "access_id" SecretKey = "secret_key" Endpoint = "endpoint" Region = "region" InitBucket = "init_bucket" LocalStorageType Type = "LocalStorage" SecureLocation = "secure_location" // Auth CloudKey = "AWS_ACCESS_KEY" // #nosec G101 CloudSecret = "AWS_SECRET_KEY" // #nosec G101 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudStorage ¶
type CloudStorage struct {
BucketRef *blob.Bucket
BucketName string
Prefix string
StorageName string
}
func (*CloudStorage) FindAllFiles ¶
func (s *CloudStorage) FindAllFiles(folder string, fullPath bool) ([]string, error)
func (*CloudStorage) GetPrefix ¶
func (s *CloudStorage) GetPrefix() string
func (*CloudStorage) Name ¶
func (s *CloudStorage) Name() string
type ContextStorage ¶
type ContextStorage string
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage default storage engine
func (*LocalStorage) FindAllFiles ¶
func (s *LocalStorage) FindAllFiles(folder string, fullPath bool) ([]string, error)
func (*LocalStorage) GetPrefix ¶
func (s *LocalStorage) GetPrefix() string
GetPrefix should always return "" for local storage
func (*LocalStorage) Name ¶
func (s *LocalStorage) Name() string
type Storage ¶
type Storage interface {
WriteFile(filename string, data []byte) error // WriteFile returns error or writes byte array to destination
ReadFile(filename string) ([]byte, error) // ReadFile returns byte array or error with data from file
FindAllFiles(folder string, fullPath bool) ([]string, error) // FindAllFiles recursively list all files for a given path
Name() string // Name of storage engine
GetPrefix() string // Prefix used by storage engine
}
TODO: pull all the cloud based interaction into a Plugin System
func NewCloudStorage ¶
NewCloudStorage creates a CloudStorage instance using context‑provided config. It validates context, parses app data, supports custom S3 endpoints or native cloud URLs, initializes the bucket (creating it if requested), and returns a configured Storage.
func NewLocalStorage ¶
Click to show internal directories.
Click to hide internal directories.