MCPcopy
hub / github.com/cloudreve/cloudreve / Handler

Interface Handler

pkg/filemanager/driver/handler.go:44–87  ·  view source on GitHub ↗

Handler 存储策略适配器

Source from the content-addressed store, hash-verified

42
43 // Handler 存储策略适配器
44 Handler interface {
45 // 上传文件, dst为文件存储路径,size 为文件大小。上下文关闭
46 // 时,应取消上传并清理临时文件
47 Put(ctx context.Context, file *fs.UploadRequest) error
48
49 // 删除一个或多个给定路径的文件,返回删除失败的文件路径列表及错误
50 Delete(ctx context.Context, files ...string) ([]string, error)
51
52 // Open physical files. Only implemented if HandlerCapabilityInboundGet capability is set.
53 // Returns file path and an os.File object.
54 Open(ctx context.Context, path string) (*os.File, error)
55
56 // LocalPath returns the local path of a file.
57 // Only implemented if HandlerCapabilityInboundGet capability is set.
58 LocalPath(ctx context.Context, path string) string
59
60 // Thumb returns the URL for a thumbnail of given entity.
61 Thumb(ctx context.Context, expire *time.Time, ext string, e fs.Entity) (string, error)
62
63 // 获取外链/下载地址,
64 // url - 站点本身地址,
65 // isDownload - 是否直接下载
66 Source(ctx context.Context, e fs.Entity, args *GetSourceArgs) (string, error)
67
68 // Token 获取有效期为ttl的上传凭证和签名
69 Token(ctx context.Context, uploadSession *fs.UploadSession, file *fs.UploadRequest) (*fs.UploadCredential, error)
70
71 // CancelToken 取消已经创建的有状态上传凭证
72 CancelToken(ctx context.Context, uploadSession *fs.UploadSession) error
73
74 // CompleteUpload completes a previously created upload session.
75 CompleteUpload(ctx context.Context, session *fs.UploadSession) error
76
77 // List 递归列取远程端path路径下文件、目录,不包含path本身,
78 // 返回的对象路径以path作为起始根目录.
79 // recursive - 是否递归列出
80 List(ctx context.Context, base string, onProgress ListProgressFunc, recursive bool) ([]fs.PhysicalObject, error)
81
82 // Capabilities returns the capabilities of this handler
83 Capabilities() *Capabilities
84
85 // MediaMeta extracts media metadata from the given file.
86 MediaMeta(ctx context.Context, path, ext, language string) ([]MediaMeta, error)
87 }
88
89 Capabilities struct {
90 StaticFeatures *boolset.BooleanSet

Callers 35

PutMethod · 0.65
PutMethod · 0.65
RecycleMethod · 0.65
UploadMethod · 0.65
generateThumbMethod · 0.65
DeleteMethod · 0.65
FrontendFileHandlerFunction · 0.65
OpenFunction · 0.65
GetMethod · 0.65
RestoreMethod · 0.65
getJpegOrientationFunction · 0.65
uploadArchiveMethod · 0.65

Implementers 10

Driverpkg/filemanager/driver/cos/cos.go
Driverpkg/filemanager/driver/remote/remote.g
Driverpkg/filemanager/driver/obs/obs.go
Driverpkg/filemanager/driver/oss/oss.go
Driverpkg/filemanager/driver/s3/s3.go
Driverpkg/filemanager/driver/onedrive/onedri
Driverpkg/filemanager/driver/local/local.go
Driverpkg/filemanager/driver/upyun/upyun.go
Driverpkg/filemanager/driver/ks3/ks3.go
Driverpkg/filemanager/driver/qiniu/qiniu.go

Calls

no outgoing calls

Tested by

no test coverage detected