upload

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package upload 提供文件上传与下载功能

Index

Constants

View Source
const (
	ErrNoFileSelected               = shared.ErrNoFileSelected
	ErrUnsupportedFormat            = shared.ErrUnsupportedFormat
	ErrProcessFileFailed            = shared.ErrProcessFileFailed
	ErrSaveFileFailed               = shared.ErrSaveFileFailed
	ErrOpenFileFailed               = shared.ErrOpenFileFailed
	ErrSaveUploadRecordFailed       = shared.ErrSaveUploadRecordFailed
	ErrGenericFileTooLarge          = shared.ErrGenericFileTooLarge
	ErrFileContentExtensionMismatch = shared.ErrFileContentExtensionMismatch
	ErrFileValidationFailed         = shared.ErrFileValidationFailed
	ErrInvalidMetadataJSON          = shared.ErrInvalidMetadataJSON
	ErrInvalidFileID                = shared.ErrInvalidFileID
	ErrQueryUploadRecordFailed      = shared.ErrQueryUploadRecordFailed
	ErrInvalidBatchDownloadRequest  = shared.ErrInvalidBatchDownloadRequest
	ErrInvalidIDValueFormat         = shared.ErrInvalidIDValueFormat
	ErrRetrieveUploadRecordsFailed  = shared.ErrRetrieveUploadRecordsFailed
	ErrNoValidFilesForArchive       = shared.ErrNoValidFilesForArchive
	ErrInvalidParams                = shared.ErrInvalidParams
	ErrQueryFileCountFailed         = shared.ErrQueryFileCountFailed
	ErrQueryFileListFailed          = shared.ErrQueryFileListFailed
	ErrDeleteFileFailed             = shared.ErrDeleteFileFailed
	ErrStorageReadOnly              = shared.ErrStorageReadOnly
	ErrS3KeyRequired                = shared.ErrS3KeyRequired
	ErrS3KeyTooLongFormat           = shared.ErrS3KeyTooLongFormat
	ErrS3KeyStartsWithSlash         = shared.ErrS3KeyStartsWithSlash
	ErrS3KeyContainsNullBytes       = shared.ErrS3KeyContainsNullBytes
	ErrQueryUnusedUploadsFailed     = shared.ErrQueryUnusedUploadsFailed
)

文件管理常量

View Source
const (
	PolicyCreate          = ingest.PolicyCreate
	PolicyDedupNewRecord  = ingest.PolicyDedupNewRecord
	PolicyResolveExisting = ingest.PolicyResolveExisting
)

Ingest policy constants

View Source
const (
	StorageMigrationTask   = uploadtask.StorageMigrationTask
	SystemCleanupTask      = uploadtask.SystemCleanupTask
	WarmImageCacheTask     = uploadtask.WarmImageCacheTask
	RebuildUploadStatsTask = uploadtask.RebuildUploadStatsTask
)

Task identifiers and metadata

Variables

View Source
var (
	UploadFile             = handler.UploadFile
	DownloadFile           = handler.DownloadFile
	BatchDownloadFiles     = handler.BatchDownloadFiles
	ListFiles              = handler.ListFiles
	DeleteFile             = handler.DeleteFile
	GetDistinctUploadTypes = handler.GetDistinctUploadTypes
	ListMyFiles            = handler.ListMyFiles
	DeleteMyFile           = handler.DeleteMyFile
	UpdateMyFile           = handler.UpdateMyFile
	GetFileStats           = handler.GetFileStats
	ServeFileByID          = filesrv.ServeFileByID
)

HTTP handlers

View Source
var (
	Ingest      = ingest.Ingest
	Remove      = ingest.Remove
	RemoveOwned = ingest.RemoveOwned
	FindByHash  = ingest.FindByHash
)

Programmatic ingest API

View Source
var (
	ErrIngestForbidden       = ingest.ErrForbidden
	ErrIngestStorageReadOnly = ingest.ErrStorageReadOnly
)

Ingest errors

View Source
var (
	ResetAccessCaches              = cache.ResetAccessCaches
	PublishAccessCacheInvalidation = cache.PublishAccessCacheInvalidation
)

Cache management

View Source
var (
	// Deprecated: use upload.Ingest or upload.Remove; stats are applied internally.
	ApplyUploadStatsAdd = uploadstats.ApplyUploadStatsAdd
	// Deprecated: use upload.Ingest or upload.Remove; stats are applied internally.
	ApplyUploadStatsRemove = uploadstats.ApplyUploadStatsRemove
	RebuildUploadStats     = uploadstats.RebuildUploadStats
)

Stats

View Source
var (
	CompressImageToWebP = util.CompressImageToWebP
	ValidateS3Key       = util.ValidateS3Key
)

Utilities

View Source
var (
	// StorageMigrationMeta describes the storage migration async task.
	StorageMigrationMeta = uploadtask.StorageMigrationMeta
	// SystemCleanupMeta describes the orphaned upload cleanup task.
	SystemCleanupMeta = uploadtask.SystemCleanupMeta
	// WarmImageCacheMeta describes the image compression cache warmup task.
	WarmImageCacheMeta = uploadtask.WarmImageCacheMeta
	// RebuildUploadStatsMeta describes the upload stats rebuild task.
	RebuildUploadStatsMeta = uploadtask.RebuildUploadStatsMeta
)

Functions

This section is empty.

Types

type IngestPolicy added in v1.3.0

type IngestPolicy = ingest.Policy

IngestPolicy controls hash-collision behavior during ingest.

type IngestRequest added in v1.3.0

type IngestRequest = ingest.Request

IngestRequest is the programmatic upload ingest payload.

type IngestResult added in v1.3.0

type IngestResult = ingest.Result

IngestResult reports ingest side effects.

type MigrationHandler added in v1.1.0

type MigrationHandler = uploadtask.MigrationHandler

MigrationHandler executes storage migration tasks.

type RebuildUploadStatsHandler added in v1.3.0

type RebuildUploadStatsHandler = uploadtask.RebuildUploadStatsHandler

RebuildUploadStatsHandler rebuilds upload stats from active records.

type SystemCleanupHandler added in v1.2.0

type SystemCleanupHandler = uploadtask.SystemCleanupHandler

SystemCleanupHandler removes orphaned upload files.

type WarmImageCacheHandler added in v0.3.0

type WarmImageCacheHandler = uploadtask.WarmImageCacheHandler

WarmImageCacheHandler pre-warms compressed image caches.

type WarmImageCachePayload added in v0.3.0

type WarmImageCachePayload = uploadtask.WarmImageCachePayload

WarmImageCachePayload is the payload for image cache warmup tasks.

Directories

Path Synopsis
Package cache provides in-process upload access-control caches.
Package cache provides in-process upload access-control caches.
Package filesrv serves uploaded files with access control and image compression.
Package filesrv serves uploaded files with access control and image compression.
Package handler provides upload HTTP API handlers.
Package handler provides upload HTTP API handlers.
Package ingest provides the programmatic upload domain service for Wavelet.
Package ingest provides the programmatic upload domain service for Wavelet.
Package shared holds upload error and configuration constants shared across subpackages.
Package shared holds upload error and configuration constants shared across subpackages.
Package stats maintains incremental upload statistics and aggregations.
Package stats maintains incremental upload statistics and aggregations.
Package storage provides upload storage backend operations and migration state.
Package storage provides upload storage backend operations and migration state.
Package task provides upload-related async background task handlers.
Package task provides upload-related async background task handlers.
Package util provides upload media helpers and image utilities.
Package util provides upload media helpers and image utilities.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL