Documentation
¶
Index ¶
- type ContentTypeDetector
- type DefaultContentTypeDetector
- type DefaultFilenameExtractor
- type DefaultIDGenerator
- type DefaultPayloadProcessor
- type DefaultPayloadService
- type DefaultResponseFormatter
- func (f *DefaultResponseFormatter) FormatDepotResponse(requestID string, size int, timestamp string, filename string) map[string]any
- func (f *DefaultResponseFormatter) FormatFileInfo(objectName, originalFilename string, data []byte, contentType string) FileInfo
- func (f *DefaultResponseFormatter) FormatGetResponse(requestID string, files []FileInfo, count int) map[string]any
- func (f *DefaultResponseFormatter) FormatListResponse(objects []string, count int) map[string]any
- type DefaultZipService
- type FileInfo
- type FilenameExtractor
- type IDGenerator
- type MinioService
- type MultipartPayloadProcessor
- type PayloadProcessor
- type PayloadService
- type ProcessedPayload
- type ResponseFormatter
- type StorageService
- type ZipService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentTypeDetector ¶
type ContentTypeDetector interface {
DetectFromData(data []byte) string
DetectFromFilename(filename string) string
DetectFromContentType(contentType string) string
}
ContentTypeDetector detects content types from data or filenames
type DefaultContentTypeDetector ¶
type DefaultContentTypeDetector struct{}
DefaultContentTypeDetector detects content types from various sources
func NewDefaultContentTypeDetector ¶
func NewDefaultContentTypeDetector() *DefaultContentTypeDetector
NewDefaultContentTypeDetector creates a new content type detector
func (*DefaultContentTypeDetector) DetectFromContentType ¶
func (d *DefaultContentTypeDetector) DetectFromContentType(contentType string) string
DetectFromContentType processes and normalizes existing content type
func (*DefaultContentTypeDetector) DetectFromData ¶
func (d *DefaultContentTypeDetector) DetectFromData(data []byte) string
DetectFromData detects content type from raw data (basic implementation)
func (*DefaultContentTypeDetector) DetectFromFilename ¶
func (d *DefaultContentTypeDetector) DetectFromFilename(filename string) string
DetectFromFilename detects content type from filename extension
type DefaultFilenameExtractor ¶
type DefaultFilenameExtractor struct{}
DefaultFilenameExtractor extracts filenames from HTTP headers
func NewDefaultFilenameExtractor ¶
func NewDefaultFilenameExtractor() *DefaultFilenameExtractor
NewDefaultFilenameExtractor creates a new filename extractor
func (*DefaultFilenameExtractor) Extract ¶
func (e *DefaultFilenameExtractor) Extract(contentDisposition string) string
Extract extracts filename from Content-Disposition header
type DefaultIDGenerator ¶
type DefaultIDGenerator struct{}
DefaultIDGenerator generates unique IDs using timestamp and random bytes
func NewDefaultIDGenerator ¶
func NewDefaultIDGenerator() *DefaultIDGenerator
NewDefaultIDGenerator creates a new default ID generator
func (*DefaultIDGenerator) Generate ¶
func (g *DefaultIDGenerator) Generate() string
Generate creates a unique identifier
type DefaultPayloadProcessor ¶
type DefaultPayloadProcessor struct {
// contains filtered or unexported fields
}
DefaultPayloadProcessor handles processing different types of payloads
func NewDefaultPayloadProcessor ¶
func NewDefaultPayloadProcessor(detector ContentTypeDetector) *DefaultPayloadProcessor
NewDefaultPayloadProcessor creates a new payload processor
func (*DefaultPayloadProcessor) Process ¶
func (p *DefaultPayloadProcessor) Process(requestID string, data []byte, contentType string, filename string) ([]ProcessedPayload, error)
Process processes different types of payloads
type DefaultPayloadService ¶
type DefaultPayloadService struct {
// contains filtered or unexported fields
}
DefaultPayloadService orchestrates payload operations
func NewDefaultPayloadService ¶
func NewDefaultPayloadService( storage StorageService, processor PayloadProcessor, idGenerator IDGenerator, responseFormatter ResponseFormatter, zipService ZipService, ) *DefaultPayloadService
NewDefaultPayloadService creates a new payload service with all dependencies
func (*DefaultPayloadService) ListAllPayloads ¶
func (s *DefaultPayloadService) ListAllPayloads() ([]string, error)
ListAllPayloads lists all stored payloads
func (*DefaultPayloadService) RetrievePayloads ¶
func (s *DefaultPayloadService) RetrievePayloads(requestID string, raw bool) (interface{}, error)
RetrievePayloads retrieves payloads for a given request ID
func (*DefaultPayloadService) StorePayload ¶
func (s *DefaultPayloadService) StorePayload(data []byte, contentType string, filename string) (string, error)
StorePayload processes and stores payload data
type DefaultResponseFormatter ¶
type DefaultResponseFormatter struct{}
DefaultResponseFormatter handles formatting HTTP responses
func NewDefaultResponseFormatter ¶
func NewDefaultResponseFormatter() *DefaultResponseFormatter
NewDefaultResponseFormatter creates a new response formatter
func (*DefaultResponseFormatter) FormatDepotResponse ¶
func (f *DefaultResponseFormatter) FormatDepotResponse(requestID string, size int, timestamp string, filename string) map[string]any
FormatDepotResponse formats the response for depot endpoint
func (*DefaultResponseFormatter) FormatFileInfo ¶
func (f *DefaultResponseFormatter) FormatFileInfo(objectName, originalFilename string, data []byte, contentType string) FileInfo
FormatFileInfo creates a FileInfo struct from payload data
func (*DefaultResponseFormatter) FormatGetResponse ¶
func (f *DefaultResponseFormatter) FormatGetResponse(requestID string, files []FileInfo, count int) map[string]any
FormatGetResponse formats the response for get endpoint
func (*DefaultResponseFormatter) FormatListResponse ¶
func (f *DefaultResponseFormatter) FormatListResponse(objects []string, count int) map[string]any
FormatListResponse formats the response for list endpoint
type DefaultZipService ¶
type DefaultZipService struct{}
DefaultZipService handles creating zip archives
func NewDefaultZipService ¶
func NewDefaultZipService() *DefaultZipService
NewDefaultZipService creates a new zip service
type FileInfo ¶
type FileInfo struct {
ObjectName string `json:"object_name"`
OriginalFilename string `json:"original_filename"`
Size int `json:"size"`
ContentType string `json:"content_type"`
PayloadBase64 string `json:"payload_base64"`
}
FileInfo represents file information for responses
type FilenameExtractor ¶
FilenameExtractor extracts filenames from HTTP requests
type IDGenerator ¶
type IDGenerator interface {
Generate() string
}
IDGenerator generates unique identifiers
type MinioService ¶
type MinioService struct {
// contains filtered or unexported fields
}
func NewMinioService ¶
func NewMinioService(config *config.Config) (*MinioService, error)
NewMinioService creates a new MinIO service
func (*MinioService) DeletePayload ¶
func (m *MinioService) DeletePayload(objectName string) error
DeletePayload removes a payload from MinIO
func (*MinioService) GetPayload ¶
func (m *MinioService) GetPayload(objectName string) ([]byte, error)
GetPayload retrieves a payload from MinIO
func (*MinioService) ListPayloads ¶
func (m *MinioService) ListPayloads() ([]string, error)
ListPayloads lists all payloads in the bucket
func (*MinioService) SavePayload ¶
func (m *MinioService) SavePayload(objectName string, data []byte, contentType string) error
SavePayload saves a payload to MinIO with the appropriate content type
type MultipartPayloadProcessor ¶
type MultipartPayloadProcessor struct {
// contains filtered or unexported fields
}
MultipartPayloadProcessor handles multipart form data processing
func NewMultipartPayloadProcessor ¶
func NewMultipartPayloadProcessor(detector ContentTypeDetector) *MultipartPayloadProcessor
NewMultipartPayloadProcessor creates a new multipart processor
func (*MultipartPayloadProcessor) Process ¶
func (p *MultipartPayloadProcessor) Process(requestID string, data []byte, contentType string, filename string) ([]ProcessedPayload, error)
Process processes multipart form data into individual payloads
type PayloadProcessor ¶
type PayloadProcessor interface {
Process(requestID string, data []byte, contentType string, filename string) ([]ProcessedPayload, error)
}
PayloadProcessor handles processing different types of payloads
type PayloadService ¶
type PayloadService interface {
StorePayload(data []byte, contentType string, filename string) (string, error)
RetrievePayloads(requestID string, raw bool) (interface{}, error)
ListAllPayloads() ([]string, error)
}
PayloadService orchestrates payload operations
type ProcessedPayload ¶
ProcessedPayload represents a processed payload ready for storage
type ResponseFormatter ¶
type ResponseFormatter interface {
FormatDepotResponse(requestID string, size int, timestamp string, filename string) map[string]any
FormatGetResponse(requestID string, files []FileInfo, count int) map[string]any
FormatListResponse(objects []string, count int) map[string]any
FormatFileInfo(objectName, originalFilename string, data []byte, contentType string) FileInfo
}
ResponseFormatter formats HTTP responses
type StorageService ¶
type StorageService interface {
SavePayload(objectName string, data []byte, contentType string) error
GetPayload(objectName string) ([]byte, error)
ListPayloads() ([]string, error)
DeletePayload(objectName string) error
}
StorageService interface for storage operations
type ZipService ¶
ZipService handles creating zip archives