From f875781b6e7fb94527379f0f7e21376f35fe22d2 Mon Sep 17 00:00:00 2001 From: zengge99 <83830807+zengge99@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:31:01 +0800 Subject: [PATCH] Update driver.go --- drivers/quark_share/driver.go | 87 ----------------------------------- 1 file changed, 87 deletions(-) diff --git a/drivers/quark_share/driver.go b/drivers/quark_share/driver.go index ee1c26a1c71..2f8a1c99041 100644 --- a/drivers/quark_share/driver.go +++ b/drivers/quark_share/driver.go @@ -125,91 +125,4 @@ func (d *QuarkShare) Remove(ctx context.Context, obj model.Obj) error { return err } -func (d *QuarkShare) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) error { - /* - tempFile, err := stream.CacheFullInTempFile() - if err != nil { - return err - } - defer func() { - _ = tempFile.Close() - }() - m := md5.New() - _, err = utils.CopyWithBuffer(m, tempFile) - if err != nil { - return err - } - _, err = tempFile.Seek(0, io.SeekStart) - if err != nil { - return err - } - md5Str := hex.EncodeToString(m.Sum(nil)) - s := sha1.New() - _, err = utils.CopyWithBuffer(s, tempFile) - if err != nil { - return err - } - _, err = tempFile.Seek(0, io.SeekStart) - if err != nil { - return err - } - sha1Str := hex.EncodeToString(s.Sum(nil)) - // pre - pre, err := d.upPre(stream, dstDir.GetID()) - if err != nil { - return err - } - log.Debugln("hash: ", md5Str, sha1Str) - // hash - finish, err := d.upHash(md5Str, sha1Str, pre.Data.TaskId) - if err != nil { - return err - } - if finish { - return nil - } - // part up - partSize := pre.Metadata.PartSize - var bytes []byte - md5s := make([]string, 0) - defaultBytes := make([]byte, partSize) - total := stream.GetSize() - left := total - partNumber := 1 - for left > 0 { - if utils.IsCanceled(ctx) { - return ctx.Err() - } - if left > int64(partSize) { - bytes = defaultBytes - } else { - bytes = make([]byte, left) - } - _, err := io.ReadFull(tempFile, bytes) - if err != nil { - return err - } - left -= int64(len(bytes)) - log.Debugf("left: %d", left) - m, err := d.upPart(ctx, pre, stream.GetMimetype(), partNumber, bytes) - //m, err := driver.UpPart(pre, file.GetMIMEType(), partNumber, bytes, account, md5Str, sha1Str) - if err != nil { - return err - } - if m == "finish" { - return nil - } - md5s = append(md5s, m) - partNumber++ - up(100 * float64(total-left) / float64(total)) - } - err = d.upCommit(pre, md5s) - if err != nil { - return err - } - return d.upFinish(pre) - */ - return nil -} - var _ driver.Driver = (*QuarkShare)(nil)