Documentation ¶
Index ¶
Constants ¶
View Source
const (
// FilesystemProvider indicates we'd like to use the filesystem adapter for blob.
FilesystemProvider = "filesystem"
)
View Source
const (
// GCPCloudStorageProvider indicates we'd like to use the GCP adapter for blob objectstorage.
GCPCloudStorageProvider = "gcp"
)
View Source
const (
// MemoryProvider indicates we'd like to use the memory adapter for blob.
MemoryProvider = "memory"
)
View Source
const (
// S3Provider indicates we'd like to use the s3 adapter for blob.
S3Provider = "s3"
)
Variables ¶
View Source
var ( // ErrNilConfig denotes that the provided configuration is nil. ErrNilConfig = errors.New("nil config provided") )
View Source
var ( // Providers are what we provide to the dependency injection framework. Providers = wire.NewSet( NewUploadManager, ) )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { FilesystemConfig *FilesystemConfig `json:"filesystem,omitempty" toml:"filesystem,omitempty"` S3Config *S3Config `json:"s3,omitempty" toml:"s3,omitempty"` GCPConfig *GCPConfig `json:"gcpConfig,omitempty" toml:"gcp_config,omitempty"` BucketPrefix string `json:"bucketPrefix,omitempty" toml:"bucket_prefix,omitempty"` BucketName string `json:"bucketName,omitempty" toml:"bucket_name,omitempty"` UploadFilenameKey string `json:"uploadFilenameKey,omitempty" toml:"upload_filename_key,omitempty"` Provider string `json:"provider,omitempty" toml:"provider,omitempty"` // contains filtered or unexported fields }
Config configures our UploadManager.
type FilesystemConfig ¶
type FilesystemConfig struct { RootDirectory string `json:"rootDirectory" toml:"root_directory,omitempty"` // contains filtered or unexported fields }
FilesystemConfig configures a filesystem-based objectstorage provider.
func (*FilesystemConfig) ValidateWithContext ¶
func (c *FilesystemConfig) ValidateWithContext(ctx context.Context) error
ValidateWithContext validates the FilesystemConfig.
type GCPConfig ¶
type GCPConfig struct { BucketName string `json:"bucketName" toml:"bucket_name,omitempty"` // contains filtered or unexported fields }
GCPConfig configures an GCP-based objectstorage provider.
type MockUploader ¶
MockUploader is a mock uploads.UploadManager.
func (*MockUploader) ServeFiles ¶
func (m *MockUploader) ServeFiles(res http.ResponseWriter, req *http.Request)
ServeFiles is a mock function.
type S3Config ¶
type S3Config struct { BucketName string `json:"bucketName" toml:"bucket_name,omitempty"` // contains filtered or unexported fields }
S3Config configures an S3-based objectstorage provider.
type Uploader ¶
type Uploader struct {
// contains filtered or unexported fields
}
Uploader implements our UploadManager struct.
func NewUploadManager ¶
func NewUploadManager(ctx context.Context, logger logging.Logger, tracerProvider tracing.TracerProvider, cfg *Config, routeParamManager routing.RouteParamManager) (*Uploader, error)
NewUploadManager provides a new uploads.UploadManager.
func (*Uploader) ServeFiles ¶
func (u *Uploader) ServeFiles(res http.ResponseWriter, req *http.Request)
ServeFiles saves a file to the blob.
Click to show internal directories.
Click to hide internal directories.