feat: add Reference interface to driver (#7805)

* feat: add `Reference` interface to driver

* feat(123_share): support reference 123pan
This commit is contained in:
j2rong4cn
2025-01-18 23:26:58 +08:00
committed by GitHub
parent 880cc7abca
commit ab22cf8233
15 changed files with 230 additions and 104 deletions

View File

@ -19,12 +19,12 @@ import (
type AliyundriveOpen struct {
model.Storage
Addition
base string
DriveId string
limitList func(ctx context.Context, data base.Json) (*Files, error)
limitLink func(ctx context.Context, file model.Obj) (*model.Link, error)
ref *AliyundriveOpen
}
func (d *AliyundriveOpen) Config() driver.Config {
@ -58,7 +58,17 @@ func (d *AliyundriveOpen) Init(ctx context.Context) error {
return nil
}
func (d *AliyundriveOpen) InitReference(storage driver.Driver) error {
refStorage, ok := storage.(*AliyundriveOpen)
if ok {
d.ref = refStorage
return nil
}
return errs.NotSupport
}
func (d *AliyundriveOpen) Drop(ctx context.Context) error {
d.ref = nil
return nil
}