Documentation ¶
Index ¶
- Constants
- Variables
- func CleanPath(name string) string
- func Walk(ctx context.Context, ffs Service, cmd *PathCmd, fn WalkDirFunc) error
- type CreateDirCmd
- type CreateRootDirCmd
- type FSGGCTaskRunner
- type FSMoveTaskRunner
- type FSRefreshSizeTaskRunner
- type FSRemoveDuplicateFilesRunner
- type FakeINodeBuilder
- func (f *FakeINodeBuilder) Build() *INode
- func (f *FakeINodeBuilder) BuildAndStore(ctx context.Context, db *sql.DB) *INode
- func (f *FakeINodeBuilder) CreatedAt(t time.Time) *FakeINodeBuilder
- func (f *FakeINodeBuilder) CreatedBy(user *users.User) *FakeINodeBuilder
- func (f *FakeINodeBuilder) IsRootDirectory() *FakeINodeBuilder
- func (f *FakeINodeBuilder) WithFile(file *files.FileMeta) *FakeINodeBuilder
- func (f *FakeINodeBuilder) WithID(id string) *FakeINodeBuilder
- func (f *FakeINodeBuilder) WithName(name string) *FakeINodeBuilder
- func (f *FakeINodeBuilder) WithParent(inode *INode) *FakeINodeBuilder
- func (f *FakeINodeBuilder) WithSpace(space *spaces.Space) *FakeINodeBuilder
- type INode
- func (n INode) CreatedAt() time.Time
- func (n INode) CreatedBy() uuid.UUID
- func (n INode) FileID() *uuid.UUID
- func (n INode) ID() uuid.UUID
- func (n INode) IsDir() bool
- func (n INode) LastModifiedAt() time.Time
- func (n INode) Name() string
- func (n INode) Parent() *uuid.UUID
- func (n INode) Size() uint64
- func (n INode) SpaceID() uuid.UUID
- type MockService
- func (_m *MockService) CreateDir(ctx context.Context, cmd *CreateDirCmd) (*INode, error)
- func (_m *MockService) CreateFS(ctx context.Context, user *users.User, space *spaces.Space) (*INode, error)
- func (_m *MockService) Destroy(ctx context.Context, user *users.User, space *spaces.Space) error
- func (_m *MockService) Download(ctx context.Context, cmd *PathCmd) (io.ReadSeekCloser, error)
- func (_m *MockService) Get(ctx context.Context, cmd *PathCmd) (*INode, error)
- func (_m *MockService) ListDir(ctx context.Context, cmd *PathCmd, paginateCmd *sqlstorage.PaginateCmd) ([]INode, error)
- func (_m *MockService) Move(ctx context.Context, cmd *MoveCmd) error
- func (_m *MockService) Remove(ctx context.Context, cmd *PathCmd) error
- func (_m *MockService) Rename(ctx context.Context, inode *INode, newName string) (*INode, error)
- func (_m *MockService) Upload(ctx context.Context, cmd *UploadCmd) error
- type MoveCmd
- type PathCmd
- type Result
- type Service
- type UploadCmd
- type WalkDirFunc
Constants ¶
View Source
const DefaultSpaceName = "My files"
View Source
const NoParent = uuid.UUID("00000000-0000-0000-0000-00000000000")
View Source
const WalkBatchSize = 100
Variables ¶
View Source
var ( ErrNotImplemented = errors.New("not implemented") ErrInvalidPath = errors.New("invalid path") ErrInvalidRoot = errors.New("invalid root") ErrInvalidParent = errors.New("invalid parent") ErrInvalidMimeType = errors.New("invalid mime type") ErrIsNotDir = errors.New("not a directory") ErrIsADir = errors.New("is a directory") ErrNotFound = errors.New("inode not found") ErrAlreadyExists = errors.New("already exists") )
View Source
var ExampleAliceNewFile = INode{ // contains filtered or unexported fields }
View Source
var ExampleAliceRenamedFile = INode{ // contains filtered or unexported fields }
Functions ¶
Types ¶
type CreateDirCmd ¶
func (CreateDirCmd) Validate ¶
func (t CreateDirCmd) Validate() error
type CreateRootDirCmd ¶
func (CreateRootDirCmd) Validate ¶
func (t CreateRootDirCmd) Validate() error
type FSGGCTaskRunner ¶
type FSGGCTaskRunner struct {
// contains filtered or unexported fields
}
func NewFSGGCTaskRunner ¶
func (*FSGGCTaskRunner) Name ¶
func (r *FSGGCTaskRunner) Name() string
func (*FSGGCTaskRunner) Run ¶
func (r *FSGGCTaskRunner) Run(ctx context.Context, rawArgs json.RawMessage) error
type FSMoveTaskRunner ¶
type FSMoveTaskRunner struct {
// contains filtered or unexported fields
}
func NewFSMoveTaskRunner ¶
func (*FSMoveTaskRunner) Name ¶
func (r *FSMoveTaskRunner) Name() string
func (*FSMoveTaskRunner) Run ¶
func (r *FSMoveTaskRunner) Run(ctx context.Context, rawArgs json.RawMessage) error
func (*FSMoveTaskRunner) RunArgs ¶
func (r *FSMoveTaskRunner) RunArgs(ctx context.Context, args *scheduler.FSMoveArgs) error
type FSRefreshSizeTaskRunner ¶
type FSRefreshSizeTaskRunner struct {
// contains filtered or unexported fields
}
func NewFSRefreshSizeTaskRunner ¶
func NewFSRefreshSizeTaskRunner(storage storage, files files.Service, stats stats.Service) *FSRefreshSizeTaskRunner
func (*FSRefreshSizeTaskRunner) Name ¶
func (r *FSRefreshSizeTaskRunner) Name() string
func (*FSRefreshSizeTaskRunner) Run ¶
func (r *FSRefreshSizeTaskRunner) Run(ctx context.Context, rawArgs json.RawMessage) error
func (*FSRefreshSizeTaskRunner) RunArgs ¶
func (r *FSRefreshSizeTaskRunner) RunArgs(ctx context.Context, args *scheduler.FSRefreshSizeArg) error
type FSRemoveDuplicateFilesRunner ¶
type FSRemoveDuplicateFilesRunner struct {
// contains filtered or unexported fields
}
func NewFSRemoveDuplicateFileRunner ¶
func NewFSRemoveDuplicateFileRunner(storage storage, files files.Service, scheduler scheduler.Service) *FSRemoveDuplicateFilesRunner
func (*FSRemoveDuplicateFilesRunner) Name ¶
func (r *FSRemoveDuplicateFilesRunner) Name() string
func (*FSRemoveDuplicateFilesRunner) Run ¶
func (r *FSRemoveDuplicateFilesRunner) Run(ctx context.Context, rawArgs json.RawMessage) error
func (*FSRemoveDuplicateFilesRunner) RunArgs ¶
func (r *FSRemoveDuplicateFilesRunner) RunArgs(ctx context.Context, args *scheduler.FSRemoveDuplicateFileArgs) error
type FakeINodeBuilder ¶
type FakeINodeBuilder struct {
// contains filtered or unexported fields
}
func NewFakeINode ¶
func NewFakeINode(t *testing.T) *FakeINodeBuilder
func (*FakeINodeBuilder) Build ¶
func (f *FakeINodeBuilder) Build() *INode
func (*FakeINodeBuilder) BuildAndStore ¶
func (*FakeINodeBuilder) CreatedAt ¶
func (f *FakeINodeBuilder) CreatedAt(t time.Time) *FakeINodeBuilder
func (*FakeINodeBuilder) CreatedBy ¶
func (f *FakeINodeBuilder) CreatedBy(user *users.User) *FakeINodeBuilder
func (*FakeINodeBuilder) IsRootDirectory ¶
func (f *FakeINodeBuilder) IsRootDirectory() *FakeINodeBuilder
func (*FakeINodeBuilder) WithFile ¶
func (f *FakeINodeBuilder) WithFile(file *files.FileMeta) *FakeINodeBuilder
func (*FakeINodeBuilder) WithID ¶
func (f *FakeINodeBuilder) WithID(id string) *FakeINodeBuilder
func (*FakeINodeBuilder) WithName ¶
func (f *FakeINodeBuilder) WithName(name string) *FakeINodeBuilder
func (*FakeINodeBuilder) WithParent ¶
func (f *FakeINodeBuilder) WithParent(inode *INode) *FakeINodeBuilder
func (*FakeINodeBuilder) WithSpace ¶
func (f *FakeINodeBuilder) WithSpace(space *spaces.Space) *FakeINodeBuilder
type INode ¶
type INode struct {
// contains filtered or unexported fields
}
func (INode) LastModifiedAt ¶
type MockService ¶
MockService is an autogenerated mock type for the Service type
func NewMockService ¶
func NewMockService(t interface { mock.TestingT Cleanup(func()) }) *MockService
NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockService) CreateDir ¶
func (_m *MockService) CreateDir(ctx context.Context, cmd *CreateDirCmd) (*INode, error)
CreateDir provides a mock function with given fields: ctx, cmd
func (*MockService) CreateFS ¶
func (_m *MockService) CreateFS(ctx context.Context, user *users.User, space *spaces.Space) (*INode, error)
CreateFS provides a mock function with given fields: ctx, user, space
func (*MockService) Download ¶
func (_m *MockService) Download(ctx context.Context, cmd *PathCmd) (io.ReadSeekCloser, error)
Download provides a mock function with given fields: ctx, cmd
func (*MockService) ListDir ¶
func (_m *MockService) ListDir(ctx context.Context, cmd *PathCmd, paginateCmd *sqlstorage.PaginateCmd) ([]INode, error)
ListDir provides a mock function with given fields: ctx, cmd, paginateCmd
func (*MockService) Move ¶
func (_m *MockService) Move(ctx context.Context, cmd *MoveCmd) error
Move provides a mock function with given fields: ctx, cmd
func (*MockService) Remove ¶
func (_m *MockService) Remove(ctx context.Context, cmd *PathCmd) error
Remove provides a mock function with given fields: ctx, cmd
type PathCmd ¶
type PathCmd struct {
// contains filtered or unexported fields
}
type Result ¶
type Result struct { fx.Out Service Service FSGCTask runner.TaskRunner `group:"tasks"` FSMoveTask runner.TaskRunner `group:"tasks"` FSRefreshSizeTask runner.TaskRunner `group:"tasks"` FSRemoveDuplicateFilesRunner runner.TaskRunner `group:"tasks"` }
type Service ¶
type Service interface { Destroy(ctx context.Context, user *users.User, space *spaces.Space) error CreateFS(ctx context.Context, user *users.User, space *spaces.Space) (*INode, error) CreateDir(ctx context.Context, cmd *CreateDirCmd) (*INode, error) ListDir(ctx context.Context, cmd *PathCmd, paginateCmd *sqlstorage.PaginateCmd) ([]INode, error) Remove(ctx context.Context, cmd *PathCmd) error Rename(ctx context.Context, inode *INode, newName string) (*INode, error) Move(ctx context.Context, cmd *MoveCmd) error Get(ctx context.Context, cmd *PathCmd) (*INode, error) Upload(ctx context.Context, cmd *UploadCmd) error Download(ctx context.Context, cmd *PathCmd) (io.ReadSeekCloser, error) // contains filtered or unexported methods }
Click to show internal directories.
Click to hide internal directories.