style: shorten name operations to op

This commit is contained in:
Noah Hsu
2022-08-31 21:01:15 +08:00
parent 9ec6d5be7a
commit 7ac1d14eeb
35 changed files with 110 additions and 110 deletions

View File

@ -7,7 +7,7 @@ import (
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
"github.com/alist-org/alist/v3/pkg/task"
"github.com/google/uuid"
"github.com/pkg/errors"
@ -15,7 +15,7 @@ import (
func AddURI(ctx context.Context, uri string, dstDirPath string) error {
// check storage
storage, dstDirActualPath, err := operations.GetStorageAndActualPath(dstDirPath)
storage, dstDirActualPath, err := op.GetStorageAndActualPath(dstDirPath)
if err != nil {
return errors.WithMessage(err, "failed get storage")
}
@ -24,7 +24,7 @@ func AddURI(ctx context.Context, uri string, dstDirPath string) error {
return errors.WithStack(errs.UploadNotSupported)
}
// check path is valid
obj, err := operations.Get(ctx, storage, dstDirActualPath)
obj, err := op.Get(ctx, storage, dstDirActualPath)
if err != nil {
if !errs.IsObjectNotFound(err) {
return errors.WithMessage(err, "failed get object")

View File

@ -10,7 +10,7 @@ import (
conf2 "github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/db"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
"github.com/alist-org/alist/v3/pkg/task"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
@ -39,7 +39,7 @@ func TestConnect(t *testing.T) {
func TestDown(t *testing.T) {
TestConnect(t)
err := operations.CreateStorage(context.Background(), model.Storage{
err := op.CreateStorage(context.Background(), model.Storage{
ID: 0,
MountPath: "/",
Index: 0,

View File

@ -11,7 +11,7 @@ import (
"time"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/internal/operations"
"github.com/alist-org/alist/v3/internal/op"
"github.com/alist-org/alist/v3/pkg/task"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
@ -114,7 +114,7 @@ var TransferTaskManager = task.NewTaskManager(3, func(k *uint64) {
func (m *Monitor) Complete() error {
// check dstDir again
storage, dstDirActualPath, err := operations.GetStorageAndActualPath(m.dstDirPath)
storage, dstDirActualPath, err := op.GetStorageAndActualPath(m.dstDirPath)
if err != nil {
return errors.WithMessage(err, "failed get storage")
}
@ -158,7 +158,7 @@ func (m *Monitor) Complete() error {
ReadCloser: f,
Mimetype: mimetype,
}
return operations.Put(tsk.Ctx, storage, dstDirActualPath, stream, tsk.SetProgress)
return op.Put(tsk.Ctx, storage, dstDirActualPath, stream, tsk.SetProgress)
},
}))
}