Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d9de036
feat(alias): support load balance
KirCute Dec 7, 2025
08ef98a
feat(alias): support storage match for load balance
KirCute Dec 7, 2025
a5495df
Merge branch 'main' into feat/alias-balance
KirCute Dec 7, 2025
5cefee5
feat(patch): add alias addition upgrade patch
KirCute Dec 8, 2025
a08c1d6
fix bugs
KirCute Dec 8, 2025
9d453ed
fix(op/balance): optimize compatibility
KirCute Dec 8, 2025
686b563
chore: change default read conflict policy
KirCute Dec 8, 2025
40e8801
Merge branch 'main' into feat/alias-balance
KirCute Dec 9, 2025
d2db317
Merge branch 'main' into feat/alias-balance
KirCute Dec 11, 2025
379b17d
feat(alias): refactor Alias initialization and enhance path handling
j2rong4cn Dec 11, 2025
05191be
feat(alias): enhance object masking and add support for operation res…
j2rong4cn Dec 12, 2025
14087e5
feat(alias): enhance object masking
j2rong4cn Dec 13, 2025
c78f99f
feat(fs): add permission checks
j2rong4cn Dec 13, 2025
d82f9e7
improve parsing
j2rong4cn Dec 14, 2025
e56f704
update object masks
j2rong4cn Dec 14, 2025
eacef00
feat(fs): enhance virtual file handling
j2rong4cn Dec 14, 2025
5f18e45
feat(storage): enhance virtual file retrieval and path handling
j2rong4cn Dec 14, 2025
652b57c
refactor(alias): rename path handling functions for clarity and consi…
j2rong4cn Dec 14, 2025
a24ff2b
fix(alias): update path handling in Other method to use balanced path
j2rong4cn Dec 14, 2025
cb83366
fix bug
j2rong4cn Dec 14, 2025
4d9e68b
feat(alias): add file size validation
j2rong4cn Dec 14, 2025
90360a4
feat(alias): add hash consistency check
KirCute Dec 15, 2025
bf3fb7e
移除哈希合并,
j2rong4cn Dec 15, 2025
ce749cb
Merge branch 'main' into feat/alias-balance
KirCute Dec 18, 2025
f001f2d
fix(alias): wrong behavior for all_strict/deterministic_or_all
KirCute Dec 19, 2025
4c05e21
Revert "fix(alias): wrong behavior for all_strict/deterministic_or_all"
j2rong4cn Dec 19, 2025
6a828d3
fix(alias): wrong behavior for all_strict/deterministic_or_all
j2rong4cn Dec 20, 2025
2508ceb
feat(alias): support part-based read load balance
KirCute Dec 20, 2025
7274bf5
fix(alias): list panic when leak conflict path
KirCute Dec 20, 2025
e54d810
fix(alias): remove Other load balance
KirCute Dec 20, 2025
d4f514b
fix(alias): 修复 Link 方法中 resultLink 的返回类型和内容复制问题
j2rong4cn Dec 22, 2025
50bbd20
fix(alias): 更好的下载并发?
j2rong4cn Dec 22, 2025
e72d67a
chore(alias): all tips
KirCute Dec 24, 2025
45a88af
Merge branch 'feat/alias-balance' of github.com:KirCute/OpenList into…
KirCute Dec 24, 2025
7d7080a
Merge branch 'main' into feat/alias-balance
KirCute Dec 24, 2025
88d720c
fix(alias): moving paths mismatch
KirCute Dec 25, 2025
ddb84a3
Merge branch 'main' into feat/alias-balance
jyxjjj Dec 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
626 changes: 299 additions & 327 deletions drivers/alias/driver.go

Large diffs are not rendered by default.

26 changes: 10 additions & 16 deletions drivers/alias/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ import (
)

type Addition struct {
// Usually one of two
// driver.RootPath
// define other
Paths string `json:"paths" required:"true" type:"text"`
ProtectSameName bool `json:"protect_same_name" default:"true" required:"false" help:"Protects same-name files from Delete or Rename"`
ParallelWrite bool `json:"parallel_write" type:"bool" default:"false"`
DownloadConcurrency int `json:"download_concurrency" default:"0" required:"false" type:"number" help:"Need to enable proxy"`
DownloadPartSize int `json:"download_part_size" default:"0" type:"number" required:"false" help:"Need to enable proxy. Unit: KB"`
Writable bool `json:"writable" type:"bool" default:"false"`
ProviderPassThrough bool `json:"provider_pass_through" type:"bool" default:"false"`
DetailsPassThrough bool `json:"details_pass_through" type:"bool" default:"false"`
Paths string `json:"paths" required:"true" type:"text"`
ReadConflictPolicy string `json:"read_conflict_policy" type:"select" options:"first,random,all" default:"first"`
WriteConflictPolicy string `json:"write_conflict_policy" type:"select" options:"disabled,first,deterministic,deterministic_or_all,all,all_strict" default:"disabled" help:"How the driver handles identical backend paths when renaming, removing, or making directories."`
PutConflictPolicy string `json:"put_conflict_policy" type:"select" options:"disabled,first,deterministic,deterministic_or_all,all,all_strict,random,quota,quota_strict" default:"disabled" help:"How the driver handles identical backend paths when uploading, copying, moving, or decompressing."`
FileConsistencyCheck bool `json:"file_consistency_check" type:"bool" default:"false"`
DownloadConcurrency int `json:"download_concurrency" default:"0" required:"false" type:"number" help:"Need to enable proxy"`
DownloadPartSize int `json:"download_part_size" default:"0" type:"number" required:"false" help:"Need to enable proxy. Unit: KB"`
ProviderPassThrough bool `json:"provider_pass_through" type:"bool" default:"false"`
DetailsPassThrough bool `json:"details_pass_through" type:"bool" default:"false"`
}

var config = driver.Config{
Expand All @@ -31,10 +29,6 @@ var config = driver.Config{

func init() {
op.RegisterDriver(func() driver.Driver {
return &Alias{
Addition: Addition{
ProtectSameName: true,
},
}
return &Alias{}
})
}
77 changes: 77 additions & 0 deletions drivers/alias/types.go
Original file line number Diff line number Diff line change
@@ -1 +1,78 @@
package alias

import (
"time"

"github.com/OpenListTeam/OpenList/v4/internal/model"
"github.com/OpenListTeam/OpenList/v4/pkg/utils"
"github.com/pkg/errors"
)

const (
DisabledWP = "disabled"
FirstRWP = "first"
DeterministicWP = "deterministic"
DeterministicOrAllWP = "deterministic_or_all"
AllRWP = "all"
AllStrictWP = "all_strict"
RandomBalancedRP = "random"
BalancedByQuotaP = "quota"
BalancedByQuotaStrictP = "quota_strict"
)

var (
ValidReadConflictPolicy = []string{FirstRWP, RandomBalancedRP, AllRWP}
ValidWriteConflictPolicy = []string{DisabledWP, FirstRWP, DeterministicWP, DeterministicOrAllWP, AllRWP,
AllStrictWP}
ValidPutConflictPolicy = []string{DisabledWP, FirstRWP, DeterministicWP, DeterministicOrAllWP, AllRWP,
AllStrictWP, RandomBalancedRP, BalancedByQuotaP, BalancedByQuotaStrictP}
)

var (
ErrPathConflict = errors.New("path conflict")
ErrSamePathLeak = errors.New("leak some of same-name dirs")
ErrNoEnoughSpace = errors.New("none of same-name dirs has enough space")
ErrNotEnoughSrcObjs = errors.New("cannot move fewer objs to more paths, please try copying")
)

type BalancedObjs []model.Obj

func (b BalancedObjs) GetSize() int64 {
return b[0].GetSize()
}

func (b BalancedObjs) ModTime() time.Time {
return b[0].ModTime()
}

func (b BalancedObjs) CreateTime() time.Time {
return b[0].CreateTime()
}

func (b BalancedObjs) IsDir() bool {
return b[0].IsDir()
}

func (b BalancedObjs) GetHash() utils.HashInfo {
return b[0].GetHash()
}

func (b BalancedObjs) GetName() string {
return b[0].GetName()
}

func (b BalancedObjs) GetPath() string {
return b[0].GetPath()
}

func (b BalancedObjs) GetID() string {
return b[0].GetID()
}

func (b BalancedObjs) Unwrap() model.Obj {
return b[0]
}

var _ model.Obj = (BalancedObjs)(nil)

type tempObj struct{ model.Object }
Loading