Documentation ¶
Index ¶
- Variables
- func Clean(storage ObjectStorage) error
- func Copy(dstStorage ObjectStorage, dstPath string, srcStorage ObjectStorage, ...) (int64, error)
- func Init() error
- func IsErrInvalidConfiguration(err error) bool
- func RegisterStorageType(typ Type, ...)
- func SaveFrom(objStorage ObjectStorage, p string, callback func(w io.Writer) error) error
- type ErrInvalidConfiguration
- type LocalStorage
- func (l *LocalStorage) Delete(path string) error
- func (l *LocalStorage) IterateObjects(dirName string, fn func(path string, obj Object) error) error
- func (l *LocalStorage) Open(path string) (Object, error)
- func (l *LocalStorage) Save(path string, r io.Reader, size int64) (int64, error)
- func (l *LocalStorage) Stat(path string) (os.FileInfo, error)
- func (l *LocalStorage) URL(path, name string) (*url.URL, error)
- type MinioStorage
- func (m *MinioStorage) Delete(path string) error
- func (m *MinioStorage) IterateObjects(dirName string, fn func(path string, obj Object) error) error
- func (m *MinioStorage) Open(path string) (Object, error)
- func (m *MinioStorage) Save(path string, r io.Reader, size int64) (int64, error)
- func (m *MinioStorage) Stat(path string) (os.FileInfo, error)
- func (m *MinioStorage) URL(path, name string) (*url.URL, error)
- type NewStorageFunc
- type Object
- type ObjectStorage
- type Type
Constants ¶
This section is empty.
Variables ¶
var ErrURLNotSupported = errors.New("url method not supported")
ErrURLNotSupported represents url is not supported
Functions ¶
func Clean ¶ added in v1.15.0
func Clean(storage ObjectStorage) error
Clean delete all the objects in this storage
func Copy ¶
func Copy(dstStorage ObjectStorage, dstPath string, srcStorage ObjectStorage, srcPath string) (int64, error)
Copy copies a file from source ObjectStorage to dest ObjectStorage
func IsErrInvalidConfiguration ¶
IsErrInvalidConfiguration checks if an error is an ErrInvalidConfiguration
func RegisterStorageType ¶
func RegisterStorageType(typ Type, fn func(ctx context.Context, cfg *setting.Storage) (ObjectStorage, error))
RegisterStorageType registers a provided storage type with a function to create it
Types ¶
type ErrInvalidConfiguration ¶
type ErrInvalidConfiguration struct {
// contains filtered or unexported fields
}
ErrInvalidConfiguration is called when there is invalid configuration for a storage
func (ErrInvalidConfiguration) Error ¶
func (err ErrInvalidConfiguration) Error() string
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage represents a local files storage
func (*LocalStorage) IterateObjects ¶
IterateObjects iterates across the objects in the local storage
type MinioStorage ¶
type MinioStorage struct {
// contains filtered or unexported fields
}
MinioStorage returns a minio bucket storage
func (*MinioStorage) IterateObjects ¶
IterateObjects iterates across the objects in the miniostorage
func (*MinioStorage) Open ¶
func (m *MinioStorage) Open(path string) (Object, error)
Open opens a file
type NewStorageFunc ¶
NewStorageFunc is a function that creates a storage
type ObjectStorage ¶
type ObjectStorage interface { Open(path string) (Object, error) // Save store a object, if size is unknown set -1 Save(path string, r io.Reader, size int64) (int64, error) Stat(path string) (os.FileInfo, error) Delete(path string) error URL(path, name string) (*url.URL, error) IterateObjects(path string, iterator func(path string, obj Object) error) error }
ObjectStorage represents an object storage to handle a bucket and files
var ( // Attachments represents attachments storage Attachments ObjectStorage = uninitializedStorage // LFS represents lfs storage LFS ObjectStorage = uninitializedStorage // Avatars represents user avatars storage Avatars ObjectStorage = uninitializedStorage // RepoAvatars represents repository avatars storage RepoAvatars ObjectStorage = uninitializedStorage // RepoArchives represents repository archives storage RepoArchives ObjectStorage = uninitializedStorage // Packages represents packages storage Packages ObjectStorage = uninitializedStorage // Actions represents actions storage Actions ObjectStorage = uninitializedStorage // Actions Artifacts represents actions artifacts storage ActionsArtifacts ObjectStorage = uninitializedStorage )
func NewLocalStorage ¶
NewLocalStorage returns a local files
func NewMinioStorage ¶
NewMinioStorage returns a minio storage
func NewStorage ¶
func NewStorage(typStr Type, cfg *setting.Storage) (ObjectStorage, error)
NewStorage takes a storage type and some config and returns an ObjectStorage or an error
type Type ¶
type Type = setting.StorageType