Documentation
¶
Index ¶
- type CloudProvider
- func (p *CloudProvider) Close() error
- func (p *CloudProvider) Delete(ctx context.Context, path string) error
- func (p *CloudProvider) GetURL(ctx context.Context, path string) (string, error)
- func (p *CloudProvider) Open(ctx context.Context, path string) (io.ReadCloser, error)
- func (p *CloudProvider) Upload(ctx context.Context, path string, data io.Reader) (string, error)
- type Module
- type ObjectStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudProvider ¶
type CloudProvider struct {
// contains filtered or unexported fields
}
CloudProvider implements ObjectStorage using local filesystem and memory fallbacks, avoiding external heavy cloud SDK dependencies.
func NewCloudProvider ¶
func NewCloudProvider(ctx context.Context, bucketURL string) (*CloudProvider, error)
NewCloudProvider creates a new CloudProvider from a bucket URL. Example URLs: - Mem: mem:// - Local: file:///path/to/dir (use file:///C:/path on Windows) - Fallback relative/absolute directory path: ./uploads
func (*CloudProvider) Delete ¶
func (p *CloudProvider) Delete(ctx context.Context, path string) error
Delete removes a file from storage.
func (*CloudProvider) Open ¶
func (p *CloudProvider) Open(ctx context.Context, path string) (io.ReadCloser, error)
Open retrieves a file from storage.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module implements the mdk.Module interface for Storage.
func (*Module) Provider ¶
func (m *Module) Provider() ObjectStorage
Provider returns the underlying storage provider.
type ObjectStorage ¶
type ObjectStorage interface {
// Upload saves a file to storage and returns its path or URL.
Upload(ctx context.Context, path string, data io.Reader) (string, error)
// Open retrieves a file from storage.
Open(ctx context.Context, path string) (io.ReadCloser, error)
// Delete removes a file from storage.
Delete(ctx context.Context, path string) error
// GetURL returns a public or signed URL for a file.
GetURL(ctx context.Context, path string) (string, error)
}
ObjectStorage defines the contract for OS-level file handling.
Click to show internal directories.
Click to hide internal directories.