mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-11-25 19:37:41 +08:00
* 新增清真云Open驱动,支持最新的轻量SDK * Change Go version in go.mod Downgrade Go version from 1.24.2 to 1.23.4 Signed-off-by: zzzhr1990 <zzzhr@hotmail.com> * Apply suggestions from code review * Removed unnecessary comments * Downgraded the Go version to 1.23.4. * Not sure whether FileStream supports concurrent read and write operations, so currently using single-threaded upload to ensure safety. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: zzzhr1990 <zzzhr@hotmail.com> * feat(halalcloud_open): support disk usage * Set useSingleUpload to true for upload safety Not sure whether FileStream supports concurrent read and write operations, so currently using single-threaded upload to ensure safety. Signed-off-by: zzzhr1990 <zzzhr@hotmail.com> * Update meta.go Change required for RefreshToken, If using a personal API approach, the RefreshToken is not required. Signed-off-by: zzzhr1990 <zzzhr@hotmail.com> * remove debug logs * bump halalcloud SDK version * fix unnecessary params * Update drivers/halalcloud_open/driver_init.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: zzzhr1990 <zzzhr@hotmail.com> * Fixed spelling errors; changed hardcoded retry parameters to constants. * remove pointer in get link function in utils.go --------- Signed-off-by: zzzhr1990 <zzzhr@hotmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: KirCute <951206789@qq.com>
61 lines
1.1 KiB
Go
61 lines
1.1 KiB
Go
package halalcloudopen
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/OpenListTeam/OpenList/v4/internal/model"
|
|
"github.com/OpenListTeam/OpenList/v4/pkg/utils"
|
|
sdkUserFile "github.com/halalcloud/golang-sdk-lite/halalcloud/services/userfile"
|
|
)
|
|
|
|
type ObjFile struct {
|
|
sdkFile *sdkUserFile.File
|
|
fileSize int64
|
|
modTime time.Time
|
|
createTime time.Time
|
|
}
|
|
|
|
func NewObjFile(f *sdkUserFile.File) model.Obj {
|
|
ofile := &ObjFile{sdkFile: f}
|
|
ofile.fileSize = f.Size
|
|
modTimeTs := f.UpdateTs
|
|
ofile.modTime = time.UnixMilli(modTimeTs)
|
|
createTimeTs := f.CreateTs
|
|
ofile.createTime = time.UnixMilli(createTimeTs)
|
|
return ofile
|
|
}
|
|
|
|
func (f *ObjFile) GetSize() int64 {
|
|
return f.fileSize
|
|
}
|
|
|
|
func (f *ObjFile) GetName() string {
|
|
return f.sdkFile.Name
|
|
}
|
|
|
|
func (f *ObjFile) ModTime() time.Time {
|
|
return f.modTime
|
|
}
|
|
|
|
func (f *ObjFile) IsDir() bool {
|
|
return f.sdkFile.Dir
|
|
}
|
|
|
|
func (f *ObjFile) GetHash() utils.HashInfo {
|
|
return utils.HashInfo{
|
|
// TODO: support more hash types
|
|
}
|
|
}
|
|
|
|
func (f *ObjFile) GetID() string {
|
|
return f.sdkFile.Identity
|
|
}
|
|
|
|
func (f *ObjFile) GetPath() string {
|
|
return f.sdkFile.Path
|
|
}
|
|
|
|
func (f *ObjFile) CreateTime() time.Time {
|
|
return f.createTime
|
|
}
|