Documentation ¶
Index ¶
- Variables
- func NewErrorCode(text string) error
- func NewServicer(ty string, ps ...types.Pair) (types.Servicer, error)
- func NewServicerFromString(conn string, ps ...types.Pair) (types.Servicer, error)
- func NewStorager(ty string, ps ...types.Pair) (types.Storager, error)
- func NewStoragerFromString(conn string, ps ...types.Pair) (types.Storager, error)
- func RegisterFactory(ty string, f Factory)
- func RegisterSchema(ty string, m map[string]string)
- func RegisterServicer(ty string, fn NewServicerFunc)
- func RegisterStorager(ty string, fn NewStoragerFunc)
- type Factory
- type InitError
- type InternalError
- type ListModeInvalidError
- type MetadataUnrecognizedError
- type NewServicerFunc
- type NewStoragerFunc
- type ObjectModeInvalidError
- type PairRequiredError
- type PairUnsupportedError
- type ServiceError
- type StorageError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnexpected means this is an unexpected error which go-storage can't handle ErrUnexpected = NewErrorCode("unexpected") // ErrCapabilityInsufficient means this service doesn't have this capability ErrCapabilityInsufficient = NewErrorCode("capability insufficient") // ErrRestrictionDissatisfied means this operation doesn't meat service's restriction. ErrRestrictionDissatisfied = NewErrorCode("restriction dissatisfied") // ErrObjectNotExist means the object to be operated is not exist. ErrObjectNotExist = NewErrorCode("object not exist") // ErrObjectModeInvalid means the provided object mode is invalid. ErrObjectModeInvalid = NewErrorCode("object mode invalid") // ErrPermissionDenied means this operation doesn't have enough permission. ErrPermissionDenied = NewErrorCode("permission denied") // ErrListModeInvalid means the provided list mode is invalid. ErrListModeInvalid = NewErrorCode("list mode invalid") // ErrServiceNotRegistered means this service is not registered. ErrServiceNotRegistered = NewErrorCode("service not registered") // ErrServiceInternal means this service has an internal error. ErrServiceInternal = NewErrorCode("service internal") // ErrRequestThrottled means there are too many requests. ErrRequestThrottled = NewErrorCode("request throttled") )
var ( // ErrConnectionStringInvalid means the connection string is invalid. ErrConnectionStringInvalid = NewErrorCode("connection string is invalid") )
Functions ¶
func NewErrorCode ¶
NewErrorCode creates a new error code.
Developers SHOULD use this function to define error codes (sentinel errors), instead of `NewErrorCode`
Users SHOULD NOT call this function. Use defined error codes instead.
func NewServicer ¶
NewServicer will initiate a new servicer.
func NewServicerFromString ¶
NewServicerFromString will create a new service via connection string.
func NewStorager ¶
NewStorager will initiate a new storager.
func NewStoragerFromString ¶
NewStoragerFromString will create a new storager via connection string.
func RegisterFactory ¶
RegisterFactory is used to register a new service.
NOTE:
- This function is not for public use, it should only be called in service init() function.
- This function is not concurrent-safe.
func RegisterSchema ¶
RegisterSchema will register a service's pair map.
Users SHOULD NOT call this function.
func RegisterServicer ¶
func RegisterServicer(ty string, fn NewServicerFunc)
RegisterServicer will register a servicer.
func RegisterStorager ¶
func RegisterStorager(ty string, fn NewStoragerFunc)
RegisterStorager will register a storager.
Types ¶
type Factory ¶
type Factory interface { // FromString fill factory with data parsed from connection string. // // The connection string will be parsed by the following format: // // s3://<credential>@<endpoint>/<name>/<work_dir>?force_path_style FromString(conn string) (err error) // FromMap fill factory with data parsed from map. // // The map will be parsed by the following format: // // { // "credential": <credential>, // "endpoint": <endpoint>, // "name": <name>, // "work_dir": <work_dir>, // "force_path_style": true // } FromMap(m map[string]interface{}) (err error) // WithPairs fill factory with data parsed from key-value pairs. WithPairs(ps ...types.Pair) (err error) // NewServicer will create a new service via already initialized factory. // // Service should implement `newService() (*Service, error)` // // It's possible that the factory only support init Storager, but not init Servicer. // For example, services like `fs` only have Storager but no Servicer support. // We will generate an error for it. NewServicer() (srv types.Servicer, err error) // NewStorager will create a new storage via already initialized factory. // // Service should implement `newStorage() (*Storage, error)` // // It's possible that the factory is OK to NewServicer but not OK to NewStorager. // For example, services like `s3` will fail to init a storager will user doesn't input a bucket name. // We will generate an error for it. NewStorager() (sto types.Storager, err error) }
Factory is used to initialize a new service or storage.
We will generate a Factory struct which implement this interface for each service.
func NewFactory ¶
NewFactory will create a new factory by service type.
func NewFactoryFromMap ¶
NewFactoryFromMap will create a new factory by service type and map.
TODO: we will provide NewServicerFromMap and NewStoragerFromMap in the future.
type InternalError ¶
type InternalError interface { // IsInternalError SHOULD and SHOULD ONLY be implemented by error definitions in go-storage & go-service-*. // We depends on the InternalError interface to distinguish our errors. // There's no need for user code to implement or use this function and interface. IsInternalError() }
type ListModeInvalidError ¶
ListModeInvalidError means the provided list mode is invalid.
func (ListModeInvalidError) Error ¶
func (e ListModeInvalidError) Error() string
func (ListModeInvalidError) IsInternalError ¶
func (e ListModeInvalidError) IsInternalError()
IsInternalError implements InternalError
func (ListModeInvalidError) Unwrap ¶
func (e ListModeInvalidError) Unwrap() error
type MetadataUnrecognizedError ¶
type MetadataUnrecognizedError struct { Key string Value interface{} }
MetadataUnrecognizedError means this operation meets unrecognized metadata.
func (MetadataUnrecognizedError) Error ¶
func (e MetadataUnrecognizedError) Error() string
func (MetadataUnrecognizedError) IsInternalError ¶
func (e MetadataUnrecognizedError) IsInternalError()
IsInternalError implements InternalError
func (MetadataUnrecognizedError) Unwrap ¶
func (e MetadataUnrecognizedError) Unwrap() error
Unwrap implements xerrors.Wrapper
type NewServicerFunc ¶
NewServicerFunc is a function that can initiate a new servicer.
type NewStoragerFunc ¶
NewStoragerFunc is a function that can initiate a new storager.
type ObjectModeInvalidError ¶
type ObjectModeInvalidError struct { Expected types.ObjectMode Actual types.ObjectMode }
ObjectModeInvalidError means the provided object mode is invalid.
func (ObjectModeInvalidError) Error ¶
func (e ObjectModeInvalidError) Error() string
func (ObjectModeInvalidError) IsInternalError ¶
func (e ObjectModeInvalidError) IsInternalError()
IsInternalError implements InternalError
func (ObjectModeInvalidError) Unwrap ¶
func (e ObjectModeInvalidError) Unwrap() error
type PairRequiredError ¶
type PairRequiredError struct {
Keys []string
}
PairRequiredError means this operation has required pair but missing.
func (PairRequiredError) Error ¶
func (e PairRequiredError) Error() string
func (PairRequiredError) IsInternalError ¶
func (e PairRequiredError) IsInternalError()
IsInternalError implements InternalError
func (PairRequiredError) Unwrap ¶
func (e PairRequiredError) Unwrap() error
Unwrap implements xerrors.Wrapper
type PairUnsupportedError ¶
PairUnsupportedError means this operation has unsupported pair.
func (PairUnsupportedError) Error ¶
func (e PairUnsupportedError) Error() string
func (PairUnsupportedError) IsInternalError ¶
func (e PairUnsupportedError) IsInternalError()
IsInternalError implements InternalError
func (PairUnsupportedError) Unwrap ¶
func (e PairUnsupportedError) Unwrap() error
Unwrap implements xerrors.Wrapper
type ServiceError ¶
ServiceError represent errors related to service.
Only returned in Servicer related operations
func (ServiceError) Error ¶
func (e ServiceError) Error() string
type StorageError ¶
StorageError represent errors related to storage.
Only returned in Storager related operations
func (StorageError) Error ¶
func (e StorageError) Error() string
Directories ¶
Path | Synopsis |
---|---|
Package azblob provided support for Azure Storage containers and blobs objects (https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction)
|
Package azblob provided support for Azure Storage containers and blobs objects (https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction) |
Package azfile provided support for Azure Files(https://azure.microsoft.com/en-us/services/storage/files/).
|
Package azfile provided support for Azure Files(https://azure.microsoft.com/en-us/services/storage/files/). |
Package bos provided support for bos by go-storage.
|
Package bos provided support for bos by go-storage. |
Package cephfs provided support for ceph file system(https://ceph.io).
|
Package cephfs provided support for ceph file system(https://ceph.io). |
Package cos provided support for Tencent Cloud's Cloud Object Storage (https://intl.cloud.tencent.com/product/cos)
|
Package cos provided support for Tencent Cloud's Cloud Object Storage (https://intl.cloud.tencent.com/product/cos) |
Package dropbox provides support for Dropbox (https://www.dropbox.com/).
|
Package dropbox provides support for Dropbox (https://www.dropbox.com/). |
Package example provided support for local file system.
|
Package example provided support for local file system. |
Package fs provided support for local file system.
|
Package fs provided support for local file system. |
Package ftp provided support for ftp by go-storage.
|
Package ftp provided support for ftp by go-storage. |
Package gcs provided support for Google Cloud Storage (https://cloud.google.com/storage/)
|
Package gcs provided support for Google Cloud Storage (https://cloud.google.com/storage/) |
Package gdrive provided support for local file system.
|
Package gdrive provided support for local file system. |
Package hdfs provided support for Hadoop Distributed File System (HDFS).
|
Package hdfs provided support for Hadoop Distributed File System (HDFS). |
Package kodo provided support for qiniu kodo object storage (https://www.qiniu.com/en/products/kodo)
|
Package kodo provided support for qiniu kodo object storage (https://www.qiniu.com/en/products/kodo) |
Package memory provided support for memory file system.
|
Package memory provided support for memory file system. |
Package minio provided support for minio by go-storage.
|
Package minio provided support for minio by go-storage. |
Package obs provided support for the Huawei Object Storage Service(https://www.huaweicloud.com/intl/en-us/product/obs.html).
|
Package obs provided support for the Huawei Object Storage Service(https://www.huaweicloud.com/intl/en-us/product/obs.html). |
Package ocios provided support for Oracle Object Storage(https://www.oracle.com/cloud/storage/object-storage/).
|
Package ocios provided support for Oracle Object Storage(https://www.oracle.com/cloud/storage/object-storage/). |
Package onedrive provided support for Microsoft onedrive(https://www.microsoft.com/zh-cn/microsoft-365/onedrive/online-cloud-storage).
|
Package onedrive provided support for Microsoft onedrive(https://www.microsoft.com/zh-cn/microsoft-365/onedrive/online-cloud-storage). |
Package oss provided support for Aliyun Object Storage Service (https://cn.aliyun.com/product/oss)
|
Package oss provided support for Aliyun Object Storage Service (https://cn.aliyun.com/product/oss) |
Package qingstor provided support for qingstor object storage (https://www.qingcloud.com/products/qingstor/)
|
Package qingstor provided support for qingstor object storage (https://www.qingcloud.com/products/qingstor/) |
Package s3 provided support for AWS s3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html)
|
Package s3 provided support for AWS s3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html) |
Package storj provided support for Storj Decentralized Cloud Storage(https://www.storj.io).
|
Package storj provided support for Storj Decentralized Cloud Storage(https://www.storj.io). |
Package tar provided support for tar archive files.
|
Package tar provided support for tar archive files. |
Package us3 provided support for Ucloud(https://docs.ucloud.cn).
|
Package us3 provided support for Ucloud(https://docs.ucloud.cn). |
Package uss provided support for UPYUN Storage Service (https://www.upyun.com/products/file-storage)
|
Package uss provided support for UPYUN Storage Service (https://www.upyun.com/products/file-storage) |
Package webdav provided support for webdav archive files.
|
Package webdav provided support for webdav archive files. |
Package zip provided support for zip archive files.
|
Package zip provided support for zip archive files. |