Fix: panics inside of task was not correctly logged into DB

Feat: slave node use new API to upload file to master
This commit is contained in:
HFO4
2022-03-13 16:20:50 +08:00
parent 9136f3caec
commit c89327631e
10 changed files with 54 additions and 30 deletions

View File

@@ -57,6 +57,7 @@ func NewClient(policy *model.Policy) (Client, error) {
request.WithEndpoint(serverURL.ResolveReference(base).String()),
request.WithCredential(authInstance, int64(signTTL)),
request.WithMasterMeta(),
request.WithSlaveMeta(policy.AccessKey),
),
}, nil
}

View File

@@ -52,14 +52,10 @@ func NewDriver(node cluster.Node, handler driver.Handler, policy *model.Policy)
func (d *Driver) Put(ctx context.Context, file fsctx.FileHeader) error {
defer file.Close()
src, ok := ctx.Value(fsctx.SlaveSrcPath).(string)
if !ok {
return ErrSlaveSrcPathNotExist
}
fileInfo := file.Info()
req := serializer.SlaveTransferReq{
Src: src,
Dst: file.Info().SavePath,
Src: fileInfo.Src,
Dst: fileInfo.SavePath,
Policy: d.policy,
}