storage

package
v0.0.0-...-75939a1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type StorageUseCase

type StorageUseCase struct {
	// contains filtered or unexported fields
}

func NewStorageUseCase

func NewStorageUseCase(volumeManager *VolumeManager) *StorageUseCase

func (*StorageUseCase) BigFileUpload

func (s *StorageUseCase) BigFileUpload(vid string, w http.ResponseWriter, r *http.Request) error

大文件上传

func (*StorageUseCase) CreateFile

func (s *StorageUseCase) CreateFile(ctx context.Context, req *storageV1.CreateFileReq) error

创建文件或者目录

func (*StorageUseCase) CreateVolume

func (s *StorageUseCase) CreateVolume(ctx context.Context, vol Volume) (*Volume, error)

创建存储卷

func (*StorageUseCase) DelFile

func (s *StorageUseCase) DelFile(ctx context.Context, id string, path string) error

删除文件

func (*StorageUseCase) DelVolume

func (s *StorageUseCase) DelVolume(ctx context.Context, vid string) error

删除存储卷

func (*StorageUseCase) GetFileData

func (s *StorageUseCase) GetFileData(ctx context.Context, id, path string) (string, error)

func (*StorageUseCase) GetFileUrl

func (s *StorageUseCase) GetFileUrl(ctx context.Context, id, path string) (string, error)

func (*StorageUseCase) ListFile

文件列表

func (*StorageUseCase) ListVolume

func (s *StorageUseCase) ListVolume(ctx context.Context) ([]*Volume, error)

存储卷列表

func (*StorageUseCase) MoveFile

复制/移动文件

func (*StorageUseCase) PutFile

func (s *StorageUseCase) PutFile(ctx context.Context, req *storageV1.SaveFileReq) error

func (*StorageUseCase) RenameFile

func (s *StorageUseCase) RenameFile(ctx context.Context, id string, path, newPath string, wireType uint32) error

重命名文件

type Volume

type Volume struct {
	Id             uuid.UUID
	Name           string
	ProviderName   string
	ProviderConfig []byte
	Provider       provider.VolumeProvider
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type VolumeManager

type VolumeManager struct {
	// contains filtered or unexported fields
}

卷管理器

func NewVolumeManager

func NewVolumeManager(repo VolumeRepo) (*VolumeManager, error)

创建卷管理器

func (*VolumeManager) CreateVolume

func (m *VolumeManager) CreateVolume(ctx context.Context, vol Volume) (*Volume, error)

创建卷

func (*VolumeManager) DelVolume

func (m *VolumeManager) DelVolume(ctx context.Context, vid string) error

删除卷

func (*VolumeManager) GetVolume

func (m *VolumeManager) GetVolume(vid string) (*Volume, error)

获取卷

func (*VolumeManager) GetVolumeAll

func (m *VolumeManager) GetVolumeAll(ctx context.Context) ([]*Volume, error)

获取卷

type VolumeRepo

type VolumeRepo interface {
	// 存储
	Store(context.Context, Volume) error
	// 加载全部文件信息
	LoadAll(context.Context) ([]Volume, error)
	Delete(context.Context, string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL