Documentation
¶
Overview ¶
Package storage provides functionality for the TDTP framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseURI ¶
ParseURI parses a remote storage URI like "s3://bucket/path/to/key". Returns (scheme, bucket, key, true) for known remote schemes; ("", "", "", false) for local paths.
func Register ¶
func Register(storageType string, fn StorageConstructor)
Register registers a storage constructor for a given storage type. Called from init() functions of driver packages.
Types ¶
type ObjectInfo ¶
ObjectInfo holds metadata about a stored object.
type ObjectStorage ¶
type ObjectStorage interface {
Put(ctx context.Context, key string, reader io.Reader, meta map[string]string) error
Get(ctx context.Context, key string) (io.ReadCloser, error)
Stat(ctx context.Context, key string) (*ObjectInfo, error)
List(ctx context.Context, prefix string) ([]ObjectInfo, error)
Delete(ctx context.Context, key string) error
Close() error
}
ObjectStorage is the interface for object storage backends (S3, SeaweedFS, etc.).
func New ¶
func New(cfg Config) (ObjectStorage, error)
New creates an ObjectStorage instance for the given Config.
type S3Config ¶
type S3Config struct {
Endpoint string `yaml:"endpoint"`
Region string `yaml:"region"`
Bucket string `yaml:"bucket"`
AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
DisableSSL bool `yaml:"disable_ssl,omitempty"`
}
S3Config holds S3-compatible storage settings.
type StorageConstructor ¶
type StorageConstructor func(cfg Config) (ObjectStorage, error)
StorageConstructor creates an ObjectStorage from a Config.
Click to show internal directories.
Click to hide internal directories.