Help us shape the future of Go! Take the 2026 Go Developer Survey

storage

package
v0.32.41 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPresignOrphans added in v0.14.9

func CleanPresignOrphans(ctx context.Context, c *app.RequestContext)

CleanPresignOrphans 清理远端 presign 孤儿对象(Init 后未 Complete 的直传残留, 24h 宽限期;本地后端由磁盘对账覆盖,恒返回 removed=0) POST /admin/storage/clean-presign-orphans

func GetStorageInfo

func GetStorageInfo(ctx context.Context, c *app.RequestContext)

GetStorageInfo . @router /admin/storage [GET]

func GetStorageInsights added in v0.14.9

func GetStorageInsights(ctx context.Context, c *app.RequestContext)

GetStorageInsights 存储洞察:后端形态/直传策略/双端用量/今日流量/孤儿与回收站规模 GET /admin/storage/insights

func MigrateStorage added in v0.32.33

func MigrateStorage(ctx context.Context, c *app.RequestContext)

MigrateStorage 存储迁移:把存量对象搬到目标后端。 @router /admin/storage/migrate [POST]

语义(与 app/storage/migrate.go 的实现一致):

· 取件码与分享链接**不变**(DB 记录不动,只换对象所在后端);
· **全部复制成功才切换** —— 有任何对象失败则不切换,源后端继续在用;
· 可中断可续(目标已存在的对象跳过)。

dry_run=true 时只算计划(对象数/字节数/源→目标),不复制不切换。

func SetAdminStats added in v0.16.0

func SetAdminStats(s *adminapp.Service)

SetAdminStats 注入 admin 统计服务(bootstrap 调用)——洞察/趋势消费面收口, gen handler 不直依 dao。

func SetJanitor added in v0.14.8

func SetJanitor(j *adminapp.Janitor)

SetJanitor 注入 janitor(bootstrap 调用)——孤儿清理端点与洞察计数 复用后台对账的同一实例,避免双份列举逻辑。

func SetService

func SetService(svc *storageapp.Service)

SetService 注入 service(bootstrap 调用)

func SwitchStorage

func SwitchStorage(ctx context.Context, c *app.RequestContext)

SwitchStorage . @router /admin/storage/switch [POST]

func TestStorageConnection

func TestStorageConnection(ctx context.Context, c *app.RequestContext)

TestStorageConnection . @router /admin/storage/test/:type [GET]

func UpdateStorageConfig

func UpdateStorageConfig(ctx context.Context, c *app.RequestContext)

UpdateStorageConfig . @router /admin/storage/config [PUT]

形态:**只有**扁平一种——请求体即 conf.StorageConfig 同构 JSON (type/storage_path/quota/s3/webdav/ftp/sftp/azureblob/hdfs/onedrive/oss..obs), 服务端整体校验 → Probe → 热切换 → 持久化。

旧嵌套形态 {type, config:{storage_path/webdav/s3}} **已删**(2026-10-25 删除旧版本 兼容):它只能切 local/webdav/s3 三种、且字段名与实际配置模型对不上(旧契约遗留), 保留它等于让两种写入口径并存。

Types

This section is empty.

Jump to

Keyboard shortcuts

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