Documentation
¶
Index ¶
- Variables
- func InitializeStorageContainer(config *settings.Config) error
- type LocalFileSystemObjectStorage
- func (s *LocalFileSystemObjectStorage) Delete(path string) error
- func (s *LocalFileSystemObjectStorage) Exists(path string) (bool, error)
- func (s *LocalFileSystemObjectStorage) Read(path string) (ObjectInStorage, error)
- func (s *LocalFileSystemObjectStorage) Save(path string, object ObjectInStorage) error
- type MinIOObjectStorage
- type ObjectInStorage
- type ObjectStorage
- type StorageContainer
- func (s *StorageContainer) DeleteAvatar(uid int64, fileExtension string) error
- func (s *StorageContainer) ExistsAvatar(uid int64, fileExtension string) (bool, error)
- func (s *StorageContainer) ReadAvatar(uid int64, fileExtension string) (ObjectInStorage, error)
- func (s *StorageContainer) SaveAvatar(uid int64, object ObjectInStorage, fileExtension string) error
Constants ¶
This section is empty.
Variables ¶
var (
Container = &StorageContainer{}
)
Initialize a object storage container singleton instance
Functions ¶
func InitializeStorageContainer ¶
InitializeStorageContainer initializes the current object storage according to the config
Types ¶
type LocalFileSystemObjectStorage ¶
type LocalFileSystemObjectStorage struct {
// contains filtered or unexported fields
}
LocalFileSystemObjectStorage represents local file system object storage
func NewLocalFileSystemObjectStorage ¶
func NewLocalFileSystemObjectStorage(config *settings.Config, pathPrefix string) (*LocalFileSystemObjectStorage, error)
NewLocalFileSystemObjectStorage returns a local file system object storage
func (*LocalFileSystemObjectStorage) Delete ¶
func (s *LocalFileSystemObjectStorage) Delete(path string) error
Delete returns whether delete the object according to specified the file path successfully
func (*LocalFileSystemObjectStorage) Exists ¶
func (s *LocalFileSystemObjectStorage) Exists(path string) (bool, error)
Exists returns whether the file exists
func (*LocalFileSystemObjectStorage) Read ¶
func (s *LocalFileSystemObjectStorage) Read(path string) (ObjectInStorage, error)
Read returns the object instance according to specified the file path
func (*LocalFileSystemObjectStorage) Save ¶
func (s *LocalFileSystemObjectStorage) Save(path string, object ObjectInStorage) error
Save returns whether save the object instance successfully
type MinIOObjectStorage ¶
type MinIOObjectStorage struct {
// contains filtered or unexported fields
}
MinIOObjectStorage represents MinIO object storage
func NewMinIOObjectStorage ¶
func NewMinIOObjectStorage(config *settings.Config, pathPrefix string) (*MinIOObjectStorage, error)
NewMinIOObjectStorage returns a MinIO object storage
func (*MinIOObjectStorage) Delete ¶
func (s *MinIOObjectStorage) Delete(path string) error
Delete returns whether delete the object according to specified the file path successfully
func (*MinIOObjectStorage) Exists ¶
func (s *MinIOObjectStorage) Exists(path string) (bool, error)
Exists returns whether the file exists
func (*MinIOObjectStorage) Read ¶
func (s *MinIOObjectStorage) Read(path string) (ObjectInStorage, error)
Read returns the object instance according to specified the file path
func (*MinIOObjectStorage) Save ¶
func (s *MinIOObjectStorage) Save(path string, object ObjectInStorage) error
Save returns whether save the object instance successfully
type ObjectInStorage ¶
type ObjectInStorage interface {
io.ReadCloser
io.Seeker
}
ObjectInStorage represents the object instance in the storage
type ObjectStorage ¶
type ObjectStorage interface {
Exists(path string) (bool, error)
Read(path string) (ObjectInStorage, error)
Save(path string, object ObjectInStorage) error
Delete(path string) error
}
ObjectStorage represents an object storage to store file object
type StorageContainer ¶
type StorageContainer struct {
AvatarCurrentStorage ObjectStorage
}
StorageContainer contains the current object storage
func (*StorageContainer) DeleteAvatar ¶
func (s *StorageContainer) DeleteAvatar(uid int64, fileExtension string) error
DeleteAvatar returns whether delete the user avatar from the current object storage successfully
func (*StorageContainer) ExistsAvatar ¶
func (s *StorageContainer) ExistsAvatar(uid int64, fileExtension string) (bool, error)
ExistsAvatar returns whether the user avatar exists from the current object storage
func (*StorageContainer) ReadAvatar ¶
func (s *StorageContainer) ReadAvatar(uid int64, fileExtension string) (ObjectInStorage, error)
ReadAvatar returns the user avatar from the current object storage
func (*StorageContainer) SaveAvatar ¶
func (s *StorageContainer) SaveAvatar(uid int64, object ObjectInStorage, fileExtension string) error
SaveAvatar returns whether save the user avatar into the current object storage successfully