Documentation ¶
Overview ¶
Package types intends to provide all types used in storage layer.
Code generated by go generate cmd/definitions; DO NOT EDIT.
Code generated by go generate cmd/definitions; DO NOT EDIT.
Code generated by go generate cmd/definitions; DO NOT EDIT.
Code generated by go generate cmd/definitions; DO NOT EDIT.
Index ¶
- Variables
- func NewOperationNotImplementedError(op string) error
- type Appender
- type Block
- type BlockIterator
- type BlockPage
- type Blocker
- type Continuable
- type Copier
- type Direr
- type Fetcher
- type Interceptor
- type Linker
- type ListMode
- type Mover
- type MultipartHTTPSigner
- type Multiparter
- type NextBlockFunc
- type NextObjectFunc
- type NextPartFunc
- type NextStoragerFunc
- type Object
- func (o *Object) GetAppendOffset() (int64, bool)
- func (o *Object) GetContentLength() (int64, bool)
- func (o *Object) GetContentMd5() (string, bool)
- func (o *Object) GetContentType() (string, bool)
- func (o *Object) GetEtag() (string, bool)
- func (o *Object) GetID() string
- func (o *Object) GetLastModified() (time.Time, bool)
- func (o *Object) GetLinkTarget() (string, bool)
- func (o *Object) GetMode() ObjectMode
- func (o *Object) GetMultipartID() (string, bool)
- func (o *Object) GetPath() string
- func (o *Object) GetSystemMetadata() (interface{}, bool)
- func (o *Object) GetUserMetadata() (map[string]string, bool)
- func (o *Object) MustGetAppendOffset() int64
- func (o *Object) MustGetContentLength() int64
- func (o *Object) MustGetContentMd5() string
- func (o *Object) MustGetContentType() string
- func (o *Object) MustGetEtag() string
- func (o *Object) MustGetLastModified() time.Time
- func (o *Object) MustGetLinkTarget() string
- func (o *Object) MustGetMultipartID() string
- func (o *Object) MustGetSystemMetadata() interface{}
- func (o *Object) MustGetUserMetadata() map[string]string
- func (o *Object) SetAppendOffset(v int64) *Object
- func (o *Object) SetContentLength(v int64) *Object
- func (o *Object) SetContentMd5(v string) *Object
- func (o *Object) SetContentType(v string) *Object
- func (o *Object) SetEtag(v string) *Object
- func (o *Object) SetID(v string) *Object
- func (o *Object) SetLastModified(v time.Time) *Object
- func (o *Object) SetLinkTarget(v string) *Object
- func (o *Object) SetMode(v ObjectMode) *Object
- func (o *Object) SetMultipartID(v string) *Object
- func (o *Object) SetPath(v string) *Object
- func (o *Object) SetSystemMetadata(v interface{}) *Object
- func (o *Object) SetUserMetadata(v map[string]string) *Object
- type ObjectIterator
- type ObjectMode
- func (o *ObjectMode) Add(mode ObjectMode)
- func (o *ObjectMode) Del(mode ObjectMode)
- func (o ObjectMode) IsAppend() bool
- func (o ObjectMode) IsBlock() bool
- func (o ObjectMode) IsDir() bool
- func (o ObjectMode) IsLink() bool
- func (o ObjectMode) IsPage() bool
- func (o ObjectMode) IsPart() bool
- func (o ObjectMode) IsRead() bool
- func (o ObjectMode) String() string
- type ObjectPage
- type OperationError
- type Pager
- type Pair
- type Part
- type PartIterator
- type PartPage
- type Reacherdeprecated
- type Servicer
- type StorageHTTPSigner
- type StorageMeta
- func (m *StorageMeta) GetAppendNumberMaximum() (int, bool)
- func (m *StorageMeta) GetAppendSizeMaximum() (int64, bool)
- func (m *StorageMeta) GetAppendTotalSizeMaximum() (int64, bool)
- func (m *StorageMeta) GetCopySizeMaximum() (int64, bool)
- func (m *StorageMeta) GetFetchSizeMaximum() (int64, bool)
- func (m *StorageMeta) GetLocation() (string, bool)
- func (m *StorageMeta) GetMoveSizeMaximum() (int64, bool)
- func (m *StorageMeta) GetMultipartNumberMaximum() (int, bool)
- func (m *StorageMeta) GetMultipartSizeMaximum() (int64, bool)
- func (m *StorageMeta) GetMultipartSizeMinimum() (int64, bool)
- func (m *StorageMeta) GetName() string
- func (m *StorageMeta) GetSystemMetadata() (interface{}, bool)
- func (m *StorageMeta) GetWorkDir() string
- func (m *StorageMeta) GetWriteSizeMaximum() (int64, bool)
- func (m *StorageMeta) MustGetAppendNumberMaximum() int
- func (m *StorageMeta) MustGetAppendSizeMaximum() int64
- func (m *StorageMeta) MustGetAppendTotalSizeMaximum() int64
- func (m *StorageMeta) MustGetCopySizeMaximum() int64
- func (m *StorageMeta) MustGetFetchSizeMaximum() int64
- func (m *StorageMeta) MustGetLocation() string
- func (m *StorageMeta) MustGetMoveSizeMaximum() int64
- func (m *StorageMeta) MustGetMultipartNumberMaximum() int
- func (m *StorageMeta) MustGetMultipartSizeMaximum() int64
- func (m *StorageMeta) MustGetMultipartSizeMinimum() int64
- func (m *StorageMeta) MustGetSystemMetadata() interface{}
- func (m *StorageMeta) MustGetWriteSizeMaximum() int64
- func (m *StorageMeta) SetAppendNumberMaximum(v int) *StorageMeta
- func (m *StorageMeta) SetAppendSizeMaximum(v int64) *StorageMeta
- func (m *StorageMeta) SetAppendTotalSizeMaximum(v int64) *StorageMeta
- func (m *StorageMeta) SetCopySizeMaximum(v int64) *StorageMeta
- func (m *StorageMeta) SetFetchSizeMaximum(v int64) *StorageMeta
- func (m *StorageMeta) SetLocation(v string) *StorageMeta
- func (m *StorageMeta) SetMoveSizeMaximum(v int64) *StorageMeta
- func (m *StorageMeta) SetMultipartNumberMaximum(v int) *StorageMeta
- func (m *StorageMeta) SetMultipartSizeMaximum(v int64) *StorageMeta
- func (m *StorageMeta) SetMultipartSizeMinimum(v int64) *StorageMeta
- func (m *StorageMeta) SetName(v string) *StorageMeta
- func (m *StorageMeta) SetSystemMetadata(v interface{}) *StorageMeta
- func (m *StorageMeta) SetWorkDir(v string) *StorageMeta
- func (m *StorageMeta) SetWriteSizeMaximum(v int64) *StorageMeta
- type Storager
- type StoragerIterator
- type StoragerPage
- type UnimplementedAppender
- func (s UnimplementedAppender) CommitAppend(o *Object, pairs ...Pair) (err error)
- func (s UnimplementedAppender) CommitAppendWithContext(ctx context.Context, o *Object, pairs ...Pair) (err error)
- func (s UnimplementedAppender) CreateAppend(path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedAppender) CreateAppendWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedAppender) String() string
- func (s UnimplementedAppender) WriteAppend(o *Object, r io.Reader, size int64, pairs ...Pair) (n int64, err error)
- func (s UnimplementedAppender) WriteAppendWithContext(ctx context.Context, o *Object, r io.Reader, size int64, pairs ...Pair) (n int64, err error)
- type UnimplementedBlocker
- func (s UnimplementedBlocker) CombineBlock(o *Object, bids []string, pairs ...Pair) (err error)
- func (s UnimplementedBlocker) CombineBlockWithContext(ctx context.Context, o *Object, bids []string, pairs ...Pair) (err error)
- func (s UnimplementedBlocker) CreateBlock(path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedBlocker) CreateBlockWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedBlocker) ListBlock(o *Object, pairs ...Pair) (bi *BlockIterator, err error)
- func (s UnimplementedBlocker) ListBlockWithContext(ctx context.Context, o *Object, pairs ...Pair) (bi *BlockIterator, err error)
- func (s UnimplementedBlocker) String() string
- func (s UnimplementedBlocker) WriteBlock(o *Object, r io.Reader, size int64, bid string, pairs ...Pair) (n int64, err error)
- func (s UnimplementedBlocker) WriteBlockWithContext(ctx context.Context, o *Object, r io.Reader, size int64, bid string, ...) (n int64, err error)
- type UnimplementedCopier
- type UnimplementedDirer
- type UnimplementedFetcher
- type UnimplementedLinker
- type UnimplementedMover
- type UnimplementedMultipartHTTPSigner
- func (s UnimplementedMultipartHTTPSigner) QuerySignHTTPCompleteMultipart(o *Object, parts []*Part, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedMultipartHTTPSigner) QuerySignHTTPCompleteMultipartWithContext(ctx context.Context, o *Object, parts []*Part, expire time.Duration, ...) (req *http.Request, err error)
- func (s UnimplementedMultipartHTTPSigner) QuerySignHTTPCreateMultipart(path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedMultipartHTTPSigner) QuerySignHTTPCreateMultipartWithContext(ctx context.Context, path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedMultipartHTTPSigner) QuerySignHTTPListMultipart(o *Object, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedMultipartHTTPSigner) QuerySignHTTPListMultipartWithContext(ctx context.Context, o *Object, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedMultipartHTTPSigner) QuerySignHTTPWriteMultipart(o *Object, size int64, index int, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedMultipartHTTPSigner) QuerySignHTTPWriteMultipartWithContext(ctx context.Context, o *Object, size int64, index int, expire time.Duration, ...) (req *http.Request, err error)
- func (s UnimplementedMultipartHTTPSigner) String() string
- type UnimplementedMultiparter
- func (s UnimplementedMultiparter) CompleteMultipart(o *Object, parts []*Part, pairs ...Pair) (err error)
- func (s UnimplementedMultiparter) CompleteMultipartWithContext(ctx context.Context, o *Object, parts []*Part, pairs ...Pair) (err error)
- func (s UnimplementedMultiparter) CreateMultipart(path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedMultiparter) CreateMultipartWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedMultiparter) ListMultipart(o *Object, pairs ...Pair) (pi *PartIterator, err error)
- func (s UnimplementedMultiparter) ListMultipartWithContext(ctx context.Context, o *Object, pairs ...Pair) (pi *PartIterator, err error)
- func (s UnimplementedMultiparter) String() string
- func (s UnimplementedMultiparter) WriteMultipart(o *Object, r io.Reader, size int64, index int, pairs ...Pair) (n int64, part *Part, err error)
- func (s UnimplementedMultiparter) WriteMultipartWithContext(ctx context.Context, o *Object, r io.Reader, size int64, index int, ...) (n int64, part *Part, err error)
- type UnimplementedPager
- func (s UnimplementedPager) CreatePage(path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedPager) CreatePageWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedPager) String() string
- func (s UnimplementedPager) WritePage(o *Object, r io.Reader, size int64, offset int64, pairs ...Pair) (n int64, err error)
- func (s UnimplementedPager) WritePageWithContext(ctx context.Context, o *Object, r io.Reader, size int64, offset int64, ...) (n int64, err error)
- type UnimplementedReacher
- type UnimplementedServicer
- func (s UnimplementedServicer) Create(name string, pairs ...Pair) (store Storager, err error)
- func (s UnimplementedServicer) CreateWithContext(ctx context.Context, name string, pairs ...Pair) (store Storager, err error)
- func (s UnimplementedServicer) Delete(name string, pairs ...Pair) (err error)
- func (s UnimplementedServicer) DeleteWithContext(ctx context.Context, name string, pairs ...Pair) (err error)
- func (s UnimplementedServicer) Get(name string, pairs ...Pair) (store Storager, err error)
- func (s UnimplementedServicer) GetWithContext(ctx context.Context, name string, pairs ...Pair) (store Storager, err error)
- func (s UnimplementedServicer) List(pairs ...Pair) (sti *StoragerIterator, err error)
- func (s UnimplementedServicer) ListWithContext(ctx context.Context, pairs ...Pair) (sti *StoragerIterator, err error)
- func (s UnimplementedServicer) String() string
- type UnimplementedStorageHTTPSigner
- func (s UnimplementedStorageHTTPSigner) QuerySignHTTPDelete(path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedStorageHTTPSigner) QuerySignHTTPDeleteWithContext(ctx context.Context, path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedStorageHTTPSigner) QuerySignHTTPRead(path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedStorageHTTPSigner) QuerySignHTTPReadWithContext(ctx context.Context, path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedStorageHTTPSigner) QuerySignHTTPWrite(path string, size int64, expire time.Duration, pairs ...Pair) (req *http.Request, err error)
- func (s UnimplementedStorageHTTPSigner) QuerySignHTTPWriteWithContext(ctx context.Context, path string, size int64, expire time.Duration, ...) (req *http.Request, err error)
- func (s UnimplementedStorageHTTPSigner) String() string
- type UnimplementedStorager
- func (s UnimplementedStorager) Create(path string, pairs ...Pair) (o *Object)
- func (s UnimplementedStorager) Delete(path string, pairs ...Pair) (err error)
- func (s UnimplementedStorager) DeleteWithContext(ctx context.Context, path string, pairs ...Pair) (err error)
- func (s UnimplementedStorager) List(path string, pairs ...Pair) (oi *ObjectIterator, err error)
- func (s UnimplementedStorager) ListWithContext(ctx context.Context, path string, pairs ...Pair) (oi *ObjectIterator, err error)
- func (s UnimplementedStorager) Metadata(pairs ...Pair) (meta *StorageMeta)
- func (s UnimplementedStorager) Read(path string, w io.Writer, pairs ...Pair) (n int64, err error)
- func (s UnimplementedStorager) ReadWithContext(ctx context.Context, path string, w io.Writer, pairs ...Pair) (n int64, err error)
- func (s UnimplementedStorager) Stat(path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedStorager) StatWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error)
- func (s UnimplementedStorager) String() string
- func (s UnimplementedStorager) Write(path string, r io.Reader, size int64, pairs ...Pair) (n int64, err error)
- func (s UnimplementedStorager) WriteWithContext(ctx context.Context, path string, r io.Reader, size int64, pairs ...Pair) (n int64, err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotImplemented will be returned while this operation is not // implemented by services. ErrNotImplemented = errorCode{"not implemented"} )
var IterateDone error = errorCode{"iterate is done"}
IterateDone means this iterator has returned all data.
Functions ¶
func NewOperationNotImplementedError ¶
NewOperationNotImplementedError will create a new NotImplemented error.
Types ¶
type Appender ¶
type Appender interface { // CommitAppend will commit and finish an append process. CommitAppend(o *Object, pairs ...Pair) (err error) // CommitAppendWithContext will commit and finish an append process. CommitAppendWithContext(ctx context.Context, o *Object, pairs ...Pair) (err error) // CreateAppend will create an append object. // // ## Behavior // // - CreateAppend SHOULD create an appendable object with position 0 and size 0. // - CreateAppend SHOULD NOT return an error as the object exist. // - Service SHOULD check and delete the object if exists. CreateAppend(path string, pairs ...Pair) (o *Object, err error) // CreateAppendWithContext will create an append object. // // ## Behavior // // - CreateAppend SHOULD create an appendable object with position 0 and size 0. // - CreateAppend SHOULD NOT return an error as the object exist. // - Service SHOULD check and delete the object if exists. CreateAppendWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error) // WriteAppend will append content to an append object. WriteAppend(o *Object, r io.Reader, size int64, pairs ...Pair) (n int64, err error) // WriteAppendWithContext will append content to an append object. WriteAppendWithContext(ctx context.Context, o *Object, r io.Reader, size int64, pairs ...Pair) (n int64, err error) // contains filtered or unexported methods }
Appender is the interface for Append related operations.
type BlockIterator ¶
type BlockIterator struct {
// contains filtered or unexported fields
}
func NewBlockIterator ¶
func NewBlockIterator(ctx context.Context, next NextBlockFunc, status Continuable) *BlockIterator
func (*BlockIterator) ContinuationToken ¶
func (it *BlockIterator) ContinuationToken() string
func (*BlockIterator) Next ¶
func (it *BlockIterator) Next() (object *Block, err error)
type BlockPage ¶
type BlockPage struct { Status Continuable Data []*Block }
type Blocker ¶
type Blocker interface { // CombineBlock will combine blocks into an object. CombineBlock(o *Object, bids []string, pairs ...Pair) (err error) // CombineBlockWithContext will combine blocks into an object. CombineBlockWithContext(ctx context.Context, o *Object, bids []string, pairs ...Pair) (err error) // CreateBlock will create a new block object. // // ## Behavior // - CreateBlock SHOULD NOT return an error as the object exist. // - Service that has native support for `overwrite` doesn't NEED to check the object exists or not. // - Service that doesn't have native support for `overwrite` SHOULD check and delete the object if // exists. CreateBlock(path string, pairs ...Pair) (o *Object, err error) // CreateBlockWithContext will create a new block object. // // ## Behavior // - CreateBlock SHOULD NOT return an error as the object exist. // - Service that has native support for `overwrite` doesn't NEED to check the object exists or not. // - Service that doesn't have native support for `overwrite` SHOULD check and delete the object if // exists. CreateBlockWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error) // ListBlock will list blocks belong to this object. ListBlock(o *Object, pairs ...Pair) (bi *BlockIterator, err error) // ListBlockWithContext will list blocks belong to this object. ListBlockWithContext(ctx context.Context, o *Object, pairs ...Pair) (bi *BlockIterator, err error) // WriteBlock will write content to a block. WriteBlock(o *Object, r io.Reader, size int64, bid string, pairs ...Pair) (n int64, err error) // WriteBlockWithContext will write content to a block. WriteBlockWithContext(ctx context.Context, o *Object, r io.Reader, size int64, bid string, pairs ...Pair) (n int64, err error) // contains filtered or unexported methods }
Blocker is the interface for Block related operations.
type Continuable ¶
type Continuable interface {
ContinuationToken() string
}
type Copier ¶
type Copier interface { // Copy will copy an Object or multiple object in the service. // // ## Behavior // // - Copy only copy one and only one object. // - Service DON'T NEED to support copy a non-empty directory or copy files recursively. // - User NEED to implement copy a non-empty directory and copy recursively by themself. // - Copy a file to a directory SHOULD return `ErrObjectModeInvalid`. // - Copy SHOULD NOT return an error as dst object exists. // - Service that has native support for `overwrite` doesn't NEED to check the dst object exists or // not. // - Service that doesn't have native support for `overwrite` SHOULD check and delete the dst object // if exists. // - A successful copy opration should be complete, which means the dst object's content and metadata // should be the same as src object. Copy(src string, dst string, pairs ...Pair) (err error) // CopyWithContext will copy an Object or multiple object in the service. // // ## Behavior // // - Copy only copy one and only one object. // - Service DON'T NEED to support copy a non-empty directory or copy files recursively. // - User NEED to implement copy a non-empty directory and copy recursively by themself. // - Copy a file to a directory SHOULD return `ErrObjectModeInvalid`. // - Copy SHOULD NOT return an error as dst object exists. // - Service that has native support for `overwrite` doesn't NEED to check the dst object exists or // not. // - Service that doesn't have native support for `overwrite` SHOULD check and delete the dst object // if exists. // - A successful copy opration should be complete, which means the dst object's content and metadata // should be the same as src object. CopyWithContext(ctx context.Context, src string, dst string, pairs ...Pair) (err error) // contains filtered or unexported methods }
Copier is the interface for Copy.
type Direr ¶
type Direr interface { // CreateDir will create a new dir object. CreateDir(path string, pairs ...Pair) (o *Object, err error) // CreateDirWithContext will create a new dir object. CreateDirWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error) // contains filtered or unexported methods }
Direr is the interface for Directory.
type Fetcher ¶
type Fetcher interface { // Fetch will fetch from a given url to path. // // ## Behavior // // - Fetch SHOULD NOT return an error as the object exists. // - A successful fetch operation should be complete, which means the object's content and metadata // should be the same as requiring from the url. Fetch(path string, url string, pairs ...Pair) (err error) // FetchWithContext will fetch from a given url to path. // // ## Behavior // // - Fetch SHOULD NOT return an error as the object exists. // - A successful fetch operation should be complete, which means the object's content and metadata // should be the same as requiring from the url. FetchWithContext(ctx context.Context, path string, url string, pairs ...Pair) (err error) // contains filtered or unexported methods }
Fetcher is the interface for Fetch.
type Interceptor ¶
func ChainInterceptor ¶
func ChainInterceptor(interceptors ...Interceptor) Interceptor
type Linker ¶ added in v4.4.0
type Linker interface { // CreateLink Will create a link object. // // # Behavior // // - `path` and `target` COULD be relative or absolute path. // - If `target` not exists, CreateLink will still create a link object to path. // - If `path` exists: // - If `path` is a symlink object, CreateLink will remove the symlink object and create a new link object // to path. // - If `path` is not a symlink object, CreateLink will return an ErrObjectModeInvalid error when // the service does not support overwrite. // - A link object COULD be returned in `Stat` or `List`. // - CreateLink COULD implement virtual_link feature when service without native support. // - Users SHOULD enable this feature by themselves. CreateLink(path string, target string, pairs ...Pair) (o *Object, err error) // CreateLinkWithContext Will create a link object. // // # Behavior // // - `path` and `target` COULD be relative or absolute path. // - If `target` not exists, CreateLink will still create a link object to path. // - If `path` exists: // - If `path` is a symlink object, CreateLink will remove the symlink object and create a new link object // to path. // - If `path` is not a symlink object, CreateLink will return an ErrObjectModeInvalid error when // the service does not support overwrite. // - A link object COULD be returned in `Stat` or `List`. // - CreateLink COULD implement virtual_link feature when service without native support. // - Users SHOULD enable this feature by themselves. CreateLinkWithContext(ctx context.Context, path string, target string, pairs ...Pair) (o *Object, err error) // contains filtered or unexported methods }
Linker is the interface for link
type Mover ¶
type Mover interface { // Move will move an object in the service. // // ## Behavior // // - Move only move one and only one object. // - Service DON'T NEED to support move a non-empty directory. // - User NEED to implement move a non-empty directory by themself. // - Move a file to a directory SHOULD return `ErrObjectModeInvalid`. // - Move SHOULD NOT return an error as dst object exists. // - Service that has native support for `overwrite` doesn't NEED to check the dst object exists or // not. // - Service that doesn't have native support for `overwrite` SHOULD check and delete the dst object // if exists. // - A successful move operation SHOULD be complete, which means the dst object's content and metadata // should be the same as src object. Move(src string, dst string, pairs ...Pair) (err error) // MoveWithContext will move an object in the service. // // ## Behavior // // - Move only move one and only one object. // - Service DON'T NEED to support move a non-empty directory. // - User NEED to implement move a non-empty directory by themself. // - Move a file to a directory SHOULD return `ErrObjectModeInvalid`. // - Move SHOULD NOT return an error as dst object exists. // - Service that has native support for `overwrite` doesn't NEED to check the dst object exists or // not. // - Service that doesn't have native support for `overwrite` SHOULD check and delete the dst object // if exists. // - A successful move operation SHOULD be complete, which means the dst object's content and metadata // should be the same as src object. MoveWithContext(ctx context.Context, src string, dst string, pairs ...Pair) (err error) // contains filtered or unexported methods }
Mover is the interface for Move.
type MultipartHTTPSigner ¶ added in v4.8.0
type MultipartHTTPSigner interface { // QuerySignHTTPCompleteMultipart will complete a multipart upload and construct an Object by // using query parameters to authenticate requests. QuerySignHTTPCompleteMultipart(o *Object, parts []*Part, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPCompleteMultipartWithContext will complete a multipart upload and construct // an Object by using query parameters to authenticate requests. QuerySignHTTPCompleteMultipartWithContext(ctx context.Context, o *Object, parts []*Part, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPCreateMultipart will create a new multipart by using query parameters to authenticate // requests. QuerySignHTTPCreateMultipart(path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPCreateMultipartWithContext will create a new multipart by using query parameters // to authenticate requests. QuerySignHTTPCreateMultipartWithContext(ctx context.Context, path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPListMultipart will list parts belong to this multipart by using query parameters // to authenticate requests. QuerySignHTTPListMultipart(o *Object, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPListMultipartWithContext will list parts belong to this multipart by using query // parameters to authenticate requests. QuerySignHTTPListMultipartWithContext(ctx context.Context, o *Object, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPWriteMultipart will write content to a multipart by using query parameters to authenticate // requests. QuerySignHTTPWriteMultipart(o *Object, size int64, index int, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPWriteMultipartWithContext will write content to a multipart by using query parameters // to authenticate requests. QuerySignHTTPWriteMultipartWithContext(ctx context.Context, o *Object, size int64, index int, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // contains filtered or unexported methods }
MultipartHTTPSigner is the interface for Multiparter related operations which support authentication.
type Multiparter ¶
type Multiparter interface { // CompleteMultipart will complete a multipart upload and construct an Object. CompleteMultipart(o *Object, parts []*Part, pairs ...Pair) (err error) // CompleteMultipartWithContext will complete a multipart upload and construct an Object. CompleteMultipartWithContext(ctx context.Context, o *Object, parts []*Part, pairs ...Pair) (err error) // CreateMultipart will create a new multipart. // // ## Behavior // // - CreateMultipart SHOULD NOT return an error as the object exists. CreateMultipart(path string, pairs ...Pair) (o *Object, err error) // CreateMultipartWithContext will create a new multipart. // // ## Behavior // // - CreateMultipart SHOULD NOT return an error as the object exists. CreateMultipartWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error) // ListMultipart will list parts belong to this multipart. ListMultipart(o *Object, pairs ...Pair) (pi *PartIterator, err error) // ListMultipartWithContext will list parts belong to this multipart. ListMultipartWithContext(ctx context.Context, o *Object, pairs ...Pair) (pi *PartIterator, err error) // WriteMultipart will write content to a multipart. WriteMultipart(o *Object, r io.Reader, size int64, index int, pairs ...Pair) (n int64, part *Part, err error) // WriteMultipartWithContext will write content to a multipart. WriteMultipartWithContext(ctx context.Context, o *Object, r io.Reader, size int64, index int, pairs ...Pair) (n int64, part *Part, err error) // contains filtered or unexported methods }
Multiparter is the interface for Multipart related operations.
type NextBlockFunc ¶
NextBlockFunc is the func used in iterator.
Notes - ErrDone should be return while there are no items any more. - Input Block slice should be set every time.
type NextObjectFunc ¶
type NextObjectFunc func(ctx context.Context, page *ObjectPage) error
NextObjectFunc is the func used in iterator.
Notes - ErrDone should be return while there are no items any more. - Input Object slice should be set every time.
type NextPartFunc ¶
NextPartFunc is the func used in iterator.
Notes - ErrDone should be return while there are no items any more. - Input Part slice should be set every time.
type NextStoragerFunc ¶
type NextStoragerFunc func(ctx context.Context, page *StoragerPage) error
NextStoragerFunc is the func used in iterator.
Notes - ErrDone should be return while there are no items any more. - Input Storager slice should be set every time.
type Object ¶
type Object struct { // ID is the unique key in storage. // // ID SHOULD be an absolute path compatible with the target operating system-defined file paths, // or a unique identifier specified by service. ID string Mode ObjectMode // Path is either the absolute path or the relative path towards storage's WorkDir depends on user's // input. // // Path SHOULD be Unix style. Path string // contains filtered or unexported fields }
Object is the smallest unit in go-storage.
NOTES:
- Object's fields SHOULD not be changed outside services.
- Object CANNOT be copied
- Object is concurrent safe.
- Only ID, Path, Mode are required during list operations, other fields could be fetched via lazy stat logic: https://beyondstorage.io/docs/go-storage/internal/object-lazy-stat
func (*Object) GetAppendOffset ¶
GetAppendOffset will get AppendOffset from Object.
AppendOffset is the offset of the append object.
func (*Object) GetContentLength ¶
GetContentLength will get ContentLength from Object.
func (*Object) GetContentMd5 ¶
GetContentMd5 will get ContentMd5 from Object.
func (*Object) GetContentType ¶
GetContentType will get ContentType from Object.
func (*Object) GetLastModified ¶
GetLastModified will get LastModified from Object.
func (*Object) GetLinkTarget ¶
GetLinkTarget will get LinkTarget from Object.
LinkTarget is the symlink target for link object.
func (*Object) GetMode ¶
func (o *Object) GetMode() ObjectMode
func (*Object) GetMultipartID ¶
GetMultipartID will get MultipartID from Object.
MultipartID is the part id of part object.
func (*Object) GetSystemMetadata ¶ added in v4.2.0
GetSystemMetadata will get SystemMetadata from Object.
SystemMetadata stores system defined metadata.
func (*Object) GetUserMetadata ¶
GetUserMetadata will get UserMetadata from Object.
UserMetadata stores user defined metadata.
func (*Object) MustGetAppendOffset ¶
MustGetAppendOffset will get AppendOffset from Object.
AppendOffset is the offset of the append object.
func (*Object) MustGetContentLength ¶
MustGetContentLength will get ContentLength from Object.
func (*Object) MustGetContentMd5 ¶
MustGetContentMd5 will get ContentMd5 from Object.
func (*Object) MustGetContentType ¶
MustGetContentType will get ContentType from Object.
func (*Object) MustGetEtag ¶
MustGetEtag will get Etag from Object.
func (*Object) MustGetLastModified ¶
MustGetLastModified will get LastModified from Object.
func (*Object) MustGetLinkTarget ¶
MustGetLinkTarget will get LinkTarget from Object.
LinkTarget is the symlink target for link object.
func (*Object) MustGetMultipartID ¶
MustGetMultipartID will get MultipartID from Object.
MultipartID is the part id of part object.
func (*Object) MustGetSystemMetadata ¶ added in v4.2.0
func (o *Object) MustGetSystemMetadata() interface{}
MustGetSystemMetadata will get SystemMetadata from Object.
SystemMetadata stores system defined metadata.
func (*Object) MustGetUserMetadata ¶
MustGetUserMetadata will get UserMetadata from Object.
UserMetadata stores user defined metadata.
func (*Object) SetAppendOffset ¶
SetAppendOffset will get AppendOffset into Object.
AppendOffset is the offset of the append object.
func (*Object) SetContentLength ¶
SetContentLength will get ContentLength into Object.
func (*Object) SetContentMd5 ¶
SetContentMd5 will get ContentMd5 into Object.
func (*Object) SetContentType ¶
SetContentType will get ContentType into Object.
func (*Object) SetLastModified ¶
SetLastModified will get LastModified into Object.
func (*Object) SetLinkTarget ¶
SetLinkTarget will get LinkTarget into Object.
LinkTarget is the symlink target for link object.
func (*Object) SetMode ¶
func (o *Object) SetMode(v ObjectMode) *Object
func (*Object) SetMultipartID ¶
SetMultipartID will get MultipartID into Object.
MultipartID is the part id of part object.
func (*Object) SetSystemMetadata ¶ added in v4.2.0
SetSystemMetadata will get SystemMetadata into Object.
SystemMetadata stores system defined metadata.
type ObjectIterator ¶
type ObjectIterator struct {
// contains filtered or unexported fields
}
func NewObjectIterator ¶
func NewObjectIterator(ctx context.Context, next NextObjectFunc, status Continuable) *ObjectIterator
func (*ObjectIterator) ContinuationToken ¶
func (it *ObjectIterator) ContinuationToken() string
func (*ObjectIterator) Next ¶
func (it *ObjectIterator) Next() (object *Object, err error)
type ObjectMode ¶
type ObjectMode uint32
ObjectMode describes what users can operate on this object.
Different object modes are orthogonal, and an object could have different object modes at the same time.
For example:
- ModeDir means we can do list on this object('s path) - ModeRead means we can read it as a normal file - ModeLink means we can read this object's link target
And we can compose them together:
- ModeRead | ModeLink: Think about a symlink, we can still read it. - ModeDir | ModeLink: Think about a symlink to dir. - ModeAppend | ModeRead: file in fs could be both read and append.
Reference ¶
- GSP-25: https://github.com/beyondstorage/specs/blob/master/rfcs/25-object-mode.md - Core Concept Object: https://beyondstorage.io/docs/go-storage/internal/core-concept#object
const ( // ModeDir means this Object represents a dir which can be used to list with dir mode. ModeDir ObjectMode = 1 << iota // ModeRead means this Object can be used to read content. ModeRead // ModeLink means this Object is a link which targets to another Object. ModeLink // ModePart means this Object is a Multipart Object which can be used for multipart operations. ModePart // ModeBlock means this Object is a Block Object which can be used for block operations. ModeBlock // ModePage means this Object is a Page Object which can be used for random write with offset. ModePage // ModeAppend means this Object is a Append Object which can be used for append. ModeAppend )
All available object mode
func (*ObjectMode) Add ¶
func (o *ObjectMode) Add(mode ObjectMode)
Add support add ObjectMode into current one.
Example ¶
var o ObjectMode o.Add(ModeDir) o.Add(ModeRead | ModeAppend)
Output:
func (*ObjectMode) Del ¶
func (o *ObjectMode) Del(mode ObjectMode)
Del support delete ObjectMode from current one.
Example ¶
o := ModeRead | ModeAppend o.Del(ModeAppend) o.Del(ModeRead | ModeAppend)
Output:
func (ObjectMode) IsAppend ¶
func (o ObjectMode) IsAppend() bool
func (ObjectMode) IsBlock ¶
func (o ObjectMode) IsBlock() bool
func (ObjectMode) IsDir ¶
func (o ObjectMode) IsDir() bool
func (ObjectMode) IsLink ¶
func (o ObjectMode) IsLink() bool
func (ObjectMode) IsPage ¶
func (o ObjectMode) IsPage() bool
func (ObjectMode) IsPart ¶
func (o ObjectMode) IsPart() bool
func (ObjectMode) IsRead ¶
func (o ObjectMode) IsRead() bool
func (ObjectMode) String ¶
func (o ObjectMode) String() string
String implement Stringer for ObjectMode.
An object with Read,Append will print like "read|append"
type ObjectPage ¶
type ObjectPage struct { Status Continuable Data []*Object }
type OperationError ¶
type OperationError struct {
// contains filtered or unexported fields
}
OperationError is the error for operation related errors.
func (OperationError) Error ¶
func (oe OperationError) Error() string
func (OperationError) IsInternalError ¶
func (oe OperationError) IsInternalError()
func (OperationError) Unwrap ¶
func (oe OperationError) Unwrap() error
type Pager ¶
type Pager interface { // CreatePage will create a new page object. // // ## Behavior // // - CreatePage SHOULD NOT return an error as the object exists. CreatePage(path string, pairs ...Pair) (o *Object, err error) // CreatePageWithContext will create a new page object. // // ## Behavior // // - CreatePage SHOULD NOT return an error as the object exists. CreatePageWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error) // WritePage will write content to specific offset. WritePage(o *Object, r io.Reader, size int64, offset int64, pairs ...Pair) (n int64, err error) // WritePageWithContext will write content to specific offset. WritePageWithContext(ctx context.Context, o *Object, r io.Reader, size int64, offset int64, pairs ...Pair) (n int64, err error) // contains filtered or unexported methods }
Pager is the interface for Page related operations which support random write.
type Pair ¶
type Pair struct { Key string Value interface{} }
Pair will store option for storage service.
type PartIterator ¶
type PartIterator struct {
// contains filtered or unexported fields
}
func NewPartIterator ¶
func NewPartIterator(ctx context.Context, next NextPartFunc, status Continuable) *PartIterator
func (*PartIterator) ContinuationToken ¶
func (it *PartIterator) ContinuationToken() string
func (*PartIterator) Next ¶
func (it *PartIterator) Next() (object *Part, err error)
type PartPage ¶
type PartPage struct { Status Continuable Data []*Part }
type Reacher
deprecated
type Reacher interface { // Reach will provide a way, which can reach the object. // // Deprecated: Use QuerySignHTTPRead instead. Reach(path string, pairs ...Pair) (url string, err error) // ReachWithContext will provide a way, which can reach the object. // // Deprecated: Use QuerySignHTTPRead instead. ReachWithContext(ctx context.Context, path string, pairs ...Pair) (url string, err error) // contains filtered or unexported methods }
Reacher is the interface for Reach.
Deprecated: Use StorageHTTPSigner instead.
type Servicer ¶
type Servicer interface { String() string // Create will create a new storager instance. Create(name string, pairs ...Pair) (store Storager, err error) // CreateWithContext will create a new storager instance. CreateWithContext(ctx context.Context, name string, pairs ...Pair) (store Storager, err error) // Delete will delete a storager instance. Delete(name string, pairs ...Pair) (err error) // DeleteWithContext will delete a storager instance. DeleteWithContext(ctx context.Context, name string, pairs ...Pair) (err error) // Get will get a valid storager instance for service. Get(name string, pairs ...Pair) (store Storager, err error) // GetWithContext will get a valid storager instance for service. GetWithContext(ctx context.Context, name string, pairs ...Pair) (store Storager, err error) // List will list all storager instances under this service. List(pairs ...Pair) (sti *StoragerIterator, err error) // ListWithContext will list all storager instances under this service. ListWithContext(ctx context.Context, pairs ...Pair) (sti *StoragerIterator, err error) // contains filtered or unexported methods }
Servicer can maintain multipart storage services.
type StorageHTTPSigner ¶ added in v4.7.0
type StorageHTTPSigner interface { // QuerySignHTTPDelete will delete an object from service by using query parameters to authenticate // requests. QuerySignHTTPDelete(path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPDeleteWithContext will delete an object from service by using query parameters // to authenticate requests. QuerySignHTTPDeleteWithContext(ctx context.Context, path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPRead will read data from the file by using query parameters to authenticate requests. QuerySignHTTPRead(path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPReadWithContext will read data from the file by using query parameters to authenticate // requests. QuerySignHTTPReadWithContext(ctx context.Context, path string, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPWrite will write data into a file by using query parameters to authenticate requests. QuerySignHTTPWrite(path string, size int64, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // QuerySignHTTPWriteWithContext will write data into a file by using query parameters to authenticate // requests. QuerySignHTTPWriteWithContext(ctx context.Context, path string, size int64, expire time.Duration, pairs ...Pair) (req *http.Request, err error) // contains filtered or unexported methods }
StorageHTTPSigner is the interface for Storager related operations which support authentication.
type StorageMeta ¶
func NewStorageMeta ¶
func NewStorageMeta() *StorageMeta
NewStorageMeta will create a new StorageMeta.
func (*StorageMeta) GetAppendNumberMaximum ¶ added in v4.2.0
func (m *StorageMeta) GetAppendNumberMaximum() (int, bool)
func (*StorageMeta) GetAppendSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) GetAppendSizeMaximum() (int64, bool)
func (*StorageMeta) GetAppendTotalSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) GetAppendTotalSizeMaximum() (int64, bool)
func (*StorageMeta) GetCopySizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) GetCopySizeMaximum() (int64, bool)
func (*StorageMeta) GetFetchSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) GetFetchSizeMaximum() (int64, bool)
func (*StorageMeta) GetLocation ¶
func (m *StorageMeta) GetLocation() (string, bool)
func (*StorageMeta) GetMoveSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) GetMoveSizeMaximum() (int64, bool)
func (*StorageMeta) GetMultipartNumberMaximum ¶ added in v4.2.0
func (m *StorageMeta) GetMultipartNumberMaximum() (int, bool)
func (*StorageMeta) GetMultipartSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) GetMultipartSizeMaximum() (int64, bool)
func (*StorageMeta) GetMultipartSizeMinimum ¶ added in v4.2.0
func (m *StorageMeta) GetMultipartSizeMinimum() (int64, bool)
func (*StorageMeta) GetName ¶
func (m *StorageMeta) GetName() string
func (*StorageMeta) GetSystemMetadata ¶ added in v4.2.0
func (m *StorageMeta) GetSystemMetadata() (interface{}, bool)
func (*StorageMeta) GetWorkDir ¶
func (m *StorageMeta) GetWorkDir() string
func (*StorageMeta) GetWriteSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) GetWriteSizeMaximum() (int64, bool)
func (*StorageMeta) MustGetAppendNumberMaximum ¶ added in v4.2.0
func (m *StorageMeta) MustGetAppendNumberMaximum() int
func (*StorageMeta) MustGetAppendSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) MustGetAppendSizeMaximum() int64
func (*StorageMeta) MustGetAppendTotalSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) MustGetAppendTotalSizeMaximum() int64
func (*StorageMeta) MustGetCopySizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) MustGetCopySizeMaximum() int64
func (*StorageMeta) MustGetFetchSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) MustGetFetchSizeMaximum() int64
func (*StorageMeta) MustGetLocation ¶
func (m *StorageMeta) MustGetLocation() string
func (*StorageMeta) MustGetMoveSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) MustGetMoveSizeMaximum() int64
func (*StorageMeta) MustGetMultipartNumberMaximum ¶ added in v4.2.0
func (m *StorageMeta) MustGetMultipartNumberMaximum() int
func (*StorageMeta) MustGetMultipartSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) MustGetMultipartSizeMaximum() int64
func (*StorageMeta) MustGetMultipartSizeMinimum ¶ added in v4.2.0
func (m *StorageMeta) MustGetMultipartSizeMinimum() int64
func (*StorageMeta) MustGetSystemMetadata ¶ added in v4.2.0
func (m *StorageMeta) MustGetSystemMetadata() interface{}
func (*StorageMeta) MustGetWriteSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) MustGetWriteSizeMaximum() int64
func (*StorageMeta) SetAppendNumberMaximum ¶ added in v4.2.0
func (m *StorageMeta) SetAppendNumberMaximum(v int) *StorageMeta
func (*StorageMeta) SetAppendSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) SetAppendSizeMaximum(v int64) *StorageMeta
func (*StorageMeta) SetAppendTotalSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) SetAppendTotalSizeMaximum(v int64) *StorageMeta
func (*StorageMeta) SetCopySizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) SetCopySizeMaximum(v int64) *StorageMeta
func (*StorageMeta) SetFetchSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) SetFetchSizeMaximum(v int64) *StorageMeta
func (*StorageMeta) SetLocation ¶
func (m *StorageMeta) SetLocation(v string) *StorageMeta
func (*StorageMeta) SetMoveSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) SetMoveSizeMaximum(v int64) *StorageMeta
func (*StorageMeta) SetMultipartNumberMaximum ¶ added in v4.2.0
func (m *StorageMeta) SetMultipartNumberMaximum(v int) *StorageMeta
func (*StorageMeta) SetMultipartSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) SetMultipartSizeMaximum(v int64) *StorageMeta
func (*StorageMeta) SetMultipartSizeMinimum ¶ added in v4.2.0
func (m *StorageMeta) SetMultipartSizeMinimum(v int64) *StorageMeta
func (*StorageMeta) SetName ¶
func (m *StorageMeta) SetName(v string) *StorageMeta
func (*StorageMeta) SetSystemMetadata ¶ added in v4.2.0
func (m *StorageMeta) SetSystemMetadata(v interface{}) *StorageMeta
func (*StorageMeta) SetWorkDir ¶
func (m *StorageMeta) SetWorkDir(v string) *StorageMeta
func (*StorageMeta) SetWriteSizeMaximum ¶ added in v4.2.0
func (m *StorageMeta) SetWriteSizeMaximum(v int64) *StorageMeta
type Storager ¶
type Storager interface { String() string // Create will create a new object without any api call. // // ## Behavior // // - Create SHOULD NOT send any API call. // - Create SHOULD accept ObjectMode pair as object mode. Create(path string, pairs ...Pair) (o *Object) // Delete will delete an object from service. // // ## Behavior // // - Delete only delete one and only one object. // - Service DON'T NEED to support remove all. // - User NEED to implement remove_all by themself. // - Delete is idempotent. // - Successful delete always return nil error. // - Delete SHOULD never return `ObjectNotExist` // - Delete DON'T NEED to check the object exist or not. Delete(path string, pairs ...Pair) (err error) // DeleteWithContext will delete an object from service. // // ## Behavior // // - Delete only delete one and only one object. // - Service DON'T NEED to support remove all. // - User NEED to implement remove_all by themself. // - Delete is idempotent. // - Successful delete always return nil error. // - Delete SHOULD never return `ObjectNotExist` // - Delete DON'T NEED to check the object exist or not. DeleteWithContext(ctx context.Context, path string, pairs ...Pair) (err error) // List will return list a specific path. // // ## Behavior // // - Service SHOULD support default `ListMode`. // - Service SHOULD implement `ListModeDir` without the check for `VirtualDir`. // - Service DON'T NEED to `Stat` while in `List`. List(path string, pairs ...Pair) (oi *ObjectIterator, err error) // ListWithContext will return list a specific path. // // ## Behavior // // - Service SHOULD support default `ListMode`. // - Service SHOULD implement `ListModeDir` without the check for `VirtualDir`. // - Service DON'T NEED to `Stat` while in `List`. ListWithContext(ctx context.Context, path string, pairs ...Pair) (oi *ObjectIterator, err error) // Metadata will return current storager metadata. Metadata(pairs ...Pair) (meta *StorageMeta) // Read will read the file's data. Read(path string, w io.Writer, pairs ...Pair) (n int64, err error) // ReadWithContext will read the file's data. ReadWithContext(ctx context.Context, path string, w io.Writer, pairs ...Pair) (n int64, err error) // Stat will stat a path to get info of an object. // // ## Behavior // // - Stat SHOULD accept ObjectMode pair as hints. // - Service COULD have different implementations for different object mode. // - Service SHOULD check if returning ObjectMode is match Stat(path string, pairs ...Pair) (o *Object, err error) // StatWithContext will stat a path to get info of an object. // // ## Behavior // // - Stat SHOULD accept ObjectMode pair as hints. // - Service COULD have different implementations for different object mode. // - Service SHOULD check if returning ObjectMode is match StatWithContext(ctx context.Context, path string, pairs ...Pair) (o *Object, err error) // Write will write data into a file. // // ## Behavior // // - Write SHOULD support users pass nil `io.Reader`. // - Service that has native support for pass nil `io.Reader` doesn't NEED to check the `io.Reader` // is nil or not. // - Service that doesn't have native support for pass nil `io.Reader` SHOULD check and create an empty // `io.Reader` if it is nil. // - Write SHOULD NOT return an error as the object exist. // - Service that has native support for `overwrite` doesn't NEED to check the object exists or not. // - Service that doesn't have native support for `overwrite` SHOULD check and delete the object if // exists. // - A successful write operation SHOULD be complete, which means the object's content and metadata // should be the same as specified in write request. Write(path string, r io.Reader, size int64, pairs ...Pair) (n int64, err error) // WriteWithContext will write data into a file. // // ## Behavior // // - Write SHOULD support users pass nil `io.Reader`. // - Service that has native support for pass nil `io.Reader` doesn't NEED to check the `io.Reader` // is nil or not. // - Service that doesn't have native support for pass nil `io.Reader` SHOULD check and create an empty // `io.Reader` if it is nil. // - Write SHOULD NOT return an error as the object exist. // - Service that has native support for `overwrite` doesn't NEED to check the object exists or not. // - Service that doesn't have native support for `overwrite` SHOULD check and delete the object if // exists. // - A successful write operation SHOULD be complete, which means the object's content and metadata // should be the same as specified in write request. WriteWithContext(ctx context.Context, path string, r io.Reader, size int64, pairs ...Pair) (n int64, err error) // contains filtered or unexported methods }
Storager is the interface for storage service.
type StoragerIterator ¶
type StoragerIterator struct {
// contains filtered or unexported fields
}
func NewStoragerIterator ¶
func NewStoragerIterator(ctx context.Context, next NextStoragerFunc, status Continuable) *StoragerIterator
func (*StoragerIterator) ContinuationToken ¶
func (it *StoragerIterator) ContinuationToken() string
func (*StoragerIterator) Next ¶
func (it *StoragerIterator) Next() (object Storager, err error)
type StoragerPage ¶
type StoragerPage struct { Status Continuable Data []Storager }
type UnimplementedAppender ¶
type UnimplementedAppender struct { }
UnimplementedAppender must be embedded to have forward compatible implementations.
func (UnimplementedAppender) CommitAppend ¶
func (s UnimplementedAppender) CommitAppend(o *Object, pairs ...Pair) (err error)
func (UnimplementedAppender) CommitAppendWithContext ¶
func (UnimplementedAppender) CreateAppend ¶
func (s UnimplementedAppender) CreateAppend(path string, pairs ...Pair) (o *Object, err error)
func (UnimplementedAppender) CreateAppendWithContext ¶
func (UnimplementedAppender) String ¶
func (s UnimplementedAppender) String() string
func (UnimplementedAppender) WriteAppend ¶
type UnimplementedBlocker ¶
type UnimplementedBlocker struct { }
UnimplementedBlocker must be embedded to have forward compatible implementations.
func (UnimplementedBlocker) CombineBlock ¶
func (s UnimplementedBlocker) CombineBlock(o *Object, bids []string, pairs ...Pair) (err error)
func (UnimplementedBlocker) CombineBlockWithContext ¶
func (UnimplementedBlocker) CreateBlock ¶
func (s UnimplementedBlocker) CreateBlock(path string, pairs ...Pair) (o *Object, err error)
func (UnimplementedBlocker) CreateBlockWithContext ¶
func (UnimplementedBlocker) ListBlock ¶
func (s UnimplementedBlocker) ListBlock(o *Object, pairs ...Pair) (bi *BlockIterator, err error)
func (UnimplementedBlocker) ListBlockWithContext ¶
func (s UnimplementedBlocker) ListBlockWithContext(ctx context.Context, o *Object, pairs ...Pair) (bi *BlockIterator, err error)
func (UnimplementedBlocker) String ¶
func (s UnimplementedBlocker) String() string
func (UnimplementedBlocker) WriteBlock ¶
type UnimplementedCopier ¶
type UnimplementedCopier struct { }
UnimplementedCopier must be embedded to have forward compatible implementations.
func (UnimplementedCopier) Copy ¶
func (s UnimplementedCopier) Copy(src string, dst string, pairs ...Pair) (err error)
func (UnimplementedCopier) CopyWithContext ¶
func (UnimplementedCopier) String ¶
func (s UnimplementedCopier) String() string
type UnimplementedDirer ¶
type UnimplementedDirer struct { }
UnimplementedDirer must be embedded to have forward compatible implementations.
func (UnimplementedDirer) CreateDir ¶
func (s UnimplementedDirer) CreateDir(path string, pairs ...Pair) (o *Object, err error)
func (UnimplementedDirer) CreateDirWithContext ¶
func (UnimplementedDirer) String ¶
func (s UnimplementedDirer) String() string
type UnimplementedFetcher ¶
type UnimplementedFetcher struct { }
UnimplementedFetcher must be embedded to have forward compatible implementations.
func (UnimplementedFetcher) Fetch ¶
func (s UnimplementedFetcher) Fetch(path string, url string, pairs ...Pair) (err error)
func (UnimplementedFetcher) FetchWithContext ¶
func (UnimplementedFetcher) String ¶
func (s UnimplementedFetcher) String() string
type UnimplementedLinker ¶ added in v4.4.0
type UnimplementedLinker struct { }
UnimplementedLinker must be embedded to have forward compatible implementations.
func (UnimplementedLinker) CreateLink ¶ added in v4.4.0
func (UnimplementedLinker) CreateLinkWithContext ¶ added in v4.4.0
func (UnimplementedLinker) String ¶ added in v4.4.0
func (s UnimplementedLinker) String() string
type UnimplementedMover ¶
type UnimplementedMover struct { }
UnimplementedMover must be embedded to have forward compatible implementations.
func (UnimplementedMover) Move ¶
func (s UnimplementedMover) Move(src string, dst string, pairs ...Pair) (err error)
func (UnimplementedMover) MoveWithContext ¶
func (UnimplementedMover) String ¶
func (s UnimplementedMover) String() string
type UnimplementedMultipartHTTPSigner ¶ added in v4.8.0
type UnimplementedMultipartHTTPSigner struct { }
UnimplementedMultipartHTTPSigner must be embedded to have forward compatible implementations.
func (UnimplementedMultipartHTTPSigner) QuerySignHTTPCompleteMultipart ¶ added in v4.8.0
func (UnimplementedMultipartHTTPSigner) QuerySignHTTPCompleteMultipartWithContext ¶ added in v4.8.0
func (UnimplementedMultipartHTTPSigner) QuerySignHTTPCreateMultipart ¶ added in v4.8.0
func (UnimplementedMultipartHTTPSigner) QuerySignHTTPCreateMultipartWithContext ¶ added in v4.8.0
func (UnimplementedMultipartHTTPSigner) QuerySignHTTPListMultipart ¶ added in v4.8.0
func (UnimplementedMultipartHTTPSigner) QuerySignHTTPListMultipartWithContext ¶ added in v4.8.0
func (UnimplementedMultipartHTTPSigner) QuerySignHTTPWriteMultipart ¶ added in v4.8.0
func (UnimplementedMultipartHTTPSigner) QuerySignHTTPWriteMultipartWithContext ¶ added in v4.8.0
func (UnimplementedMultipartHTTPSigner) String ¶ added in v4.8.0
func (s UnimplementedMultipartHTTPSigner) String() string
type UnimplementedMultiparter ¶
type UnimplementedMultiparter struct { }
UnimplementedMultiparter must be embedded to have forward compatible implementations.
func (UnimplementedMultiparter) CompleteMultipart ¶
func (s UnimplementedMultiparter) CompleteMultipart(o *Object, parts []*Part, pairs ...Pair) (err error)
func (UnimplementedMultiparter) CompleteMultipartWithContext ¶
func (UnimplementedMultiparter) CreateMultipart ¶
func (s UnimplementedMultiparter) CreateMultipart(path string, pairs ...Pair) (o *Object, err error)
func (UnimplementedMultiparter) CreateMultipartWithContext ¶
func (UnimplementedMultiparter) ListMultipart ¶
func (s UnimplementedMultiparter) ListMultipart(o *Object, pairs ...Pair) (pi *PartIterator, err error)
func (UnimplementedMultiparter) ListMultipartWithContext ¶
func (s UnimplementedMultiparter) ListMultipartWithContext(ctx context.Context, o *Object, pairs ...Pair) (pi *PartIterator, err error)
func (UnimplementedMultiparter) String ¶
func (s UnimplementedMultiparter) String() string
func (UnimplementedMultiparter) WriteMultipart ¶
type UnimplementedPager ¶
type UnimplementedPager struct { }
UnimplementedPager must be embedded to have forward compatible implementations.
func (UnimplementedPager) CreatePage ¶
func (s UnimplementedPager) CreatePage(path string, pairs ...Pair) (o *Object, err error)
func (UnimplementedPager) CreatePageWithContext ¶
func (UnimplementedPager) String ¶
func (s UnimplementedPager) String() string
type UnimplementedReacher ¶
type UnimplementedReacher struct { }
UnimplementedReacher must be embedded to have forward compatible implementations.
func (UnimplementedReacher) Reach ¶
func (s UnimplementedReacher) Reach(path string, pairs ...Pair) (url string, err error)
func (UnimplementedReacher) ReachWithContext ¶
func (UnimplementedReacher) String ¶
func (s UnimplementedReacher) String() string
type UnimplementedServicer ¶
type UnimplementedServicer struct { }
UnimplementedServicer must be embedded to have forward compatible implementations.
func (UnimplementedServicer) Create ¶
func (s UnimplementedServicer) Create(name string, pairs ...Pair) (store Storager, err error)
func (UnimplementedServicer) CreateWithContext ¶
func (UnimplementedServicer) Delete ¶
func (s UnimplementedServicer) Delete(name string, pairs ...Pair) (err error)
func (UnimplementedServicer) DeleteWithContext ¶
func (UnimplementedServicer) Get ¶
func (s UnimplementedServicer) Get(name string, pairs ...Pair) (store Storager, err error)
func (UnimplementedServicer) GetWithContext ¶
func (UnimplementedServicer) List ¶
func (s UnimplementedServicer) List(pairs ...Pair) (sti *StoragerIterator, err error)
func (UnimplementedServicer) ListWithContext ¶
func (s UnimplementedServicer) ListWithContext(ctx context.Context, pairs ...Pair) (sti *StoragerIterator, err error)
func (UnimplementedServicer) String ¶
func (s UnimplementedServicer) String() string
type UnimplementedStorageHTTPSigner ¶ added in v4.7.0
type UnimplementedStorageHTTPSigner struct { }
UnimplementedStorageHTTPSigner must be embedded to have forward compatible implementations.
func (UnimplementedStorageHTTPSigner) QuerySignHTTPDelete ¶ added in v4.8.0
func (UnimplementedStorageHTTPSigner) QuerySignHTTPDeleteWithContext ¶ added in v4.8.0
func (UnimplementedStorageHTTPSigner) QuerySignHTTPRead ¶ added in v4.7.0
func (UnimplementedStorageHTTPSigner) QuerySignHTTPReadWithContext ¶ added in v4.7.0
func (UnimplementedStorageHTTPSigner) QuerySignHTTPWrite ¶ added in v4.7.0
func (UnimplementedStorageHTTPSigner) QuerySignHTTPWriteWithContext ¶ added in v4.7.0
func (UnimplementedStorageHTTPSigner) String ¶ added in v4.7.0
func (s UnimplementedStorageHTTPSigner) String() string
type UnimplementedStorager ¶
type UnimplementedStorager struct { }
UnimplementedStorager must be embedded to have forward compatible implementations.
func (UnimplementedStorager) Create ¶
func (s UnimplementedStorager) Create(path string, pairs ...Pair) (o *Object)
func (UnimplementedStorager) Delete ¶
func (s UnimplementedStorager) Delete(path string, pairs ...Pair) (err error)
func (UnimplementedStorager) DeleteWithContext ¶
func (UnimplementedStorager) List ¶
func (s UnimplementedStorager) List(path string, pairs ...Pair) (oi *ObjectIterator, err error)
func (UnimplementedStorager) ListWithContext ¶
func (s UnimplementedStorager) ListWithContext(ctx context.Context, path string, pairs ...Pair) (oi *ObjectIterator, err error)
func (UnimplementedStorager) Metadata ¶
func (s UnimplementedStorager) Metadata(pairs ...Pair) (meta *StorageMeta)
func (UnimplementedStorager) ReadWithContext ¶
func (UnimplementedStorager) Stat ¶
func (s UnimplementedStorager) Stat(path string, pairs ...Pair) (o *Object, err error)
func (UnimplementedStorager) StatWithContext ¶
func (UnimplementedStorager) String ¶
func (s UnimplementedStorager) String() string