Handler 存储策略适配器
| 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 |
no outgoing calls
no test coverage detected