You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.8 KiB
61 lines
1.8 KiB
package masterinslave
|
|
|
|
import (
|
|
"context"
|
|
model "github.com/cloudreve/Cloudreve/v3/models"
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/cluster"
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/driver"
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/fsctx"
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/response"
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
|
|
)
|
|
|
|
// Driver 影子存储策略,用于在从机端上传文件
|
|
type Driver struct {
|
|
master cluster.Node
|
|
handler driver.Handler
|
|
policy *model.Policy
|
|
}
|
|
|
|
// NewDriver 返回新的处理器
|
|
func NewDriver(master cluster.Node, handler driver.Handler, policy *model.Policy) driver.Handler {
|
|
return &Driver{
|
|
master: master,
|
|
handler: handler,
|
|
policy: policy,
|
|
}
|
|
}
|
|
|
|
func (d *Driver) Put(ctx context.Context, file fsctx.FileHeader) error {
|
|
return d.handler.Put(ctx, file)
|
|
}
|
|
|
|
func (d *Driver) Delete(ctx context.Context, files []string) ([]string, error) {
|
|
return d.handler.Delete(ctx, files)
|
|
}
|
|
|
|
func (d *Driver) Get(ctx context.Context, path string) (response.RSCloser, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
|
|
func (d *Driver) Thumb(ctx context.Context, file *model.File) (*response.ContentResponse, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
|
|
func (d *Driver) Source(ctx context.Context, path string, ttl int64, isDownload bool, speed int) (string, error) {
|
|
return "", ErrNotImplemented
|
|
}
|
|
|
|
func (d *Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, file fsctx.FileHeader) (*serializer.UploadCredential, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
|
|
func (d *Driver) List(ctx context.Context, path string, recursive bool) ([]response.Object, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|
|
|
|
// 取消上传凭证
|
|
func (handler Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error {
|
|
return nil
|
|
}
|