Documentation
¶
Overview ¶
Package qingstor provided support for qingstor object storage (https://www.qingcloud.com/products/qingstor/)
Code generated by go generate via internal/cmd/service; DO NOT EDIT.
Index ¶
- Constants
- Variables
- func GetStorageClass(m info.ObjectMeta) (string, bool)
- func IsBucketNameValid(s string) bool
- func New(pairs ...*types.Pair) (storage.Servicer, storage.Storager, error)
- func NewServicer(pairs ...*types.Pair) (storage.Servicer, error)
- func NewStorager(pairs ...*types.Pair) (storage.Storager, error)
- func WithDisableURICleaning(v bool) *types.Pair
- func WithStorageClass(v string) *types.Pair
- type Service
- func (s *Service) Create(name string, pairs ...*types.Pair) (store storage.Storager, err error)
- func (s *Service) CreateWithContext(ctx context.Context, name string, pairs ...*types.Pair) (store storage.Storager, err error)
- func (s *Service) Delete(name string, pairs ...*types.Pair) (err error)
- func (s *Service) DeleteWithContext(ctx context.Context, name string, pairs ...*types.Pair) (err error)
- func (s *Service) Get(name string, pairs ...*types.Pair) (store storage.Storager, err error)
- func (s *Service) GetWithContext(ctx context.Context, name string, pairs ...*types.Pair) (store storage.Storager, err error)
- func (s *Service) List(pairs ...*types.Pair) (err error)
- func (s *Service) ListWithContext(ctx context.Context, pairs ...*types.Pair) (err error)
- func (s *Service) String() string
- type Storage
- func (s *Storage) AbortSegment(seg segment.Segment, pairs ...*types.Pair) (err error)
- func (s *Storage) AbortSegmentWithContext(ctx context.Context, seg segment.Segment, pairs ...*types.Pair) (err error)
- func (s *Storage) CompleteSegment(seg segment.Segment, pairs ...*types.Pair) (err error)
- func (s *Storage) CompleteSegmentWithContext(ctx context.Context, seg segment.Segment, pairs ...*types.Pair) (err error)
- func (s *Storage) Copy(src string, dst string, pairs ...*types.Pair) (err error)
- func (s *Storage) CopyWithContext(ctx context.Context, src string, dst string, pairs ...*types.Pair) (err error)
- func (s *Storage) Delete(path string, pairs ...*types.Pair) (err error)
- func (s *Storage) DeleteWithContext(ctx context.Context, path string, pairs ...*types.Pair) (err error)
- func (s *Storage) InitIndexSegment(path string, pairs ...*types.Pair) (seg segment.Segment, err error)
- func (s *Storage) InitIndexSegmentWithContext(ctx context.Context, path string, pairs ...*types.Pair) (seg segment.Segment, err error)
- func (s *Storage) ListDir(dir string, pairs ...*types.Pair) (err error)
- func (s *Storage) ListDirWithContext(ctx context.Context, dir string, pairs ...*types.Pair) (err error)
- func (s *Storage) ListPrefix(prefix string, pairs ...*types.Pair) (err error)
- func (s *Storage) ListPrefixSegments(prefix string, pairs ...*types.Pair) (err error)
- func (s *Storage) ListPrefixSegmentsWithContext(ctx context.Context, prefix string, pairs ...*types.Pair) (err error)
- func (s *Storage) ListPrefixWithContext(ctx context.Context, prefix string, pairs ...*types.Pair) (err error)
- func (s *Storage) Metadata(pairs ...*types.Pair) (meta info.StorageMeta, err error)
- func (s *Storage) MetadataWithContext(ctx context.Context, pairs ...*types.Pair) (meta info.StorageMeta, err error)
- func (s *Storage) Move(src string, dst string, pairs ...*types.Pair) (err error)
- func (s *Storage) MoveWithContext(ctx context.Context, src string, dst string, pairs ...*types.Pair) (err error)
- func (s *Storage) Reach(path string, pairs ...*types.Pair) (url string, err error)
- func (s *Storage) ReachWithContext(ctx context.Context, path string, pairs ...*types.Pair) (url string, err error)
- func (s *Storage) Read(path string, pairs ...*types.Pair) (rc io.ReadCloser, err error)
- func (s *Storage) ReadWithContext(ctx context.Context, path string, pairs ...*types.Pair) (rc io.ReadCloser, err error)
- func (s *Storage) Stat(path string, pairs ...*types.Pair) (o *types.Object, err error)
- func (s *Storage) StatWithContext(ctx context.Context, path string, pairs ...*types.Pair) (o *types.Object, err error)
- func (s *Storage) Statistical(pairs ...*types.Pair) (statistic info.StorageStatistic, err error)
- func (s *Storage) StatisticalWithContext(ctx context.Context, pairs ...*types.Pair) (statistic info.StorageStatistic, err error)
- func (s *Storage) String() string
- func (s *Storage) Write(path string, r io.Reader, pairs ...*types.Pair) (err error)
- func (s *Storage) WriteIndexSegment(seg segment.Segment, r io.Reader, index int, size int64, pairs ...*types.Pair) (err error)
- func (s *Storage) WriteIndexSegmentWithContext(ctx context.Context, seg segment.Segment, r io.Reader, index int, size int64, ...) (err error)
- func (s *Storage) WriteWithContext(ctx context.Context, path string, r io.Reader, pairs ...*types.Pair) (err error)
Examples ¶
Constants ¶
const ( // DisableURICleaning will // DisableURICleaning PairDisableURICleaning = "qingstor_disable_uri_cleaning" // StorageClass will // StorageClass PairStorageClass = "qingstor_storage_class" )
Service available pairs.
const ( StorageClassStandard = "STANDARD" StorageClassStandardIA = "STANDARD_IA" )
All available storage classes are listed here.
const (
InfoObjectMetaStorageClass = "qingstor-storage-class"
)
Service available infos.
const Type = "qingstor"
Type is the type for qingstor
Variables ¶
var ( // ErrInvalidBucketName will be returned while bucket name is invalid. ErrInvalidBucketName = errors.New("invalid bucket name") // ErrInvalidWorkDir will be returned while work dir is invalid. // Work dir must start and end with only one '/' ErrInvalidWorkDir = errors.New("invalid work dir") )
Functions ¶
func GetStorageClass ¶ added in v1.1.0
func GetStorageClass(m info.ObjectMeta) (string, bool)
GetStorageClass will get storage-class value from metadata.
func IsBucketNameValid ¶ added in v0.3.0
IsBucketNameValid will check whether given string is a valid bucket name.
func New ¶
New will create both Servicer and Storager.
Example ¶
_, _, err := New( pairs.WithCredential( credential.MustNewHmac("test_access_key", "test_secret_key"), ), ) if err != nil { log.Printf("service init failed: %v", err) }
Output:
func NewServicer ¶ added in v1.0.0
NewServicer will create Servicer only.
func NewStorager ¶ added in v1.0.0
NewStorager will create Storager only.
func WithDisableURICleaning ¶ added in v1.1.0
WithDisableURICleaning will apply disable_uri_cleaning value to Options This pair is used to // DisableURICleaning
func WithStorageClass ¶ added in v1.1.0
WithStorageClass will apply storage_class value to Options This pair is used to // StorageClass
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the qingstor service config.
func (*Service) Create ¶
Create will create a new storager instance.
This function will create a context by default.
func (*Service) CreateWithContext ¶ added in v0.6.0
func (s *Service) CreateWithContext(ctx context.Context, name string, pairs ...*types.Pair) (store storage.Storager, err error)
CreateWithContext will create a new storager instance.
func (*Service) Delete ¶
Delete will delete a storager instance.
This function will create a context by default.
func (*Service) DeleteWithContext ¶ added in v0.6.0
func (s *Service) DeleteWithContext(ctx context.Context, name string, pairs ...*types.Pair) (err error)
DeleteWithContext will delete a storager instance.
func (*Service) Get ¶
Get will get a valid storager instance for service.
This function will create a context by default.
Example ¶
srv, _, err := New( pairs.WithCredential( credential.MustNewHmac("test_access_key", "test_secret_key"), ), ) if err != nil { log.Printf("service init failed: %v", err) } store, err := srv.Get("bucket_name", pairs.WithLocation("location")) if err != nil { log.Printf("service get bucket failed: %v", err) } log.Printf("%v", store)
Output:
func (*Service) GetWithContext ¶ added in v0.6.0
func (s *Service) GetWithContext(ctx context.Context, name string, pairs ...*types.Pair) (store storage.Storager, err error)
GetWithContext will get a valid storager instance for service.
func (*Service) List ¶
List will list all storager instances under this service.
This function will create a context by default.
func (*Service) ListWithContext ¶ added in v0.6.0
ListWithContext will list all storager instances under this service.
type Storage ¶ added in v0.4.0
type Storage struct {
// contains filtered or unexported fields
}
Storage is the qingstor object storage client.
func (*Storage) AbortSegment ¶ added in v0.4.0
AbortSegment will abort a segment.
This function will create a context by default.
func (*Storage) AbortSegmentWithContext ¶ added in v0.6.0
func (s *Storage) AbortSegmentWithContext(ctx context.Context, seg segment.Segment, pairs ...*types.Pair) (err error)
AbortSegmentWithContext will abort a segment.
func (*Storage) CompleteSegment ¶ added in v0.4.0
CompleteSegment will complete a segment and merge them into a File.
This function will create a context by default.
func (*Storage) CompleteSegmentWithContext ¶ added in v0.6.0
func (s *Storage) CompleteSegmentWithContext(ctx context.Context, seg segment.Segment, pairs ...*types.Pair) (err error)
CompleteSegmentWithContext will complete a segment and merge them into a File.
func (*Storage) Copy ¶ added in v0.4.0
Copy will copy an Object or multiple object in the service.
This function will create a context by default.
func (*Storage) CopyWithContext ¶ added in v0.6.0
func (s *Storage) CopyWithContext(ctx context.Context, src string, dst string, pairs ...*types.Pair) (err error)
CopyWithContext will copy an Object or multiple object in the service.
func (*Storage) Delete ¶ added in v0.4.0
Delete will delete an Object from service.
This function will create a context by default.
func (*Storage) DeleteWithContext ¶ added in v0.6.0
func (s *Storage) DeleteWithContext(ctx context.Context, path string, pairs ...*types.Pair) (err error)
DeleteWithContext will delete an Object from service.
func (*Storage) InitIndexSegment ¶ added in v1.1.0
func (s *Storage) InitIndexSegment(path string, pairs ...*types.Pair) (seg segment.Segment, err error)
InitIndexSegment will init an index based segment.
This function will create a context by default.
func (*Storage) InitIndexSegmentWithContext ¶ added in v1.1.0
func (s *Storage) InitIndexSegmentWithContext(ctx context.Context, path string, pairs ...*types.Pair) (seg segment.Segment, err error)
InitIndexSegmentWithContext will init an index based segment.
func (*Storage) ListDir ¶ added in v0.4.0
ListDir will return list a specific dir.
This function will create a context by default.
func (*Storage) ListDirWithContext ¶ added in v1.0.0
func (s *Storage) ListDirWithContext(ctx context.Context, dir string, pairs ...*types.Pair) (err error)
ListDirWithContext will return list a specific dir.
func (*Storage) ListPrefix ¶ added in v1.0.0
ListPrefix will return list a specific dir.
This function will create a context by default.
func (*Storage) ListPrefixSegments ¶ added in v1.0.0
ListPrefixSegments will list segments.
This function will create a context by default.
func (*Storage) ListPrefixSegmentsWithContext ¶ added in v1.0.0
func (s *Storage) ListPrefixSegmentsWithContext(ctx context.Context, prefix string, pairs ...*types.Pair) (err error)
ListPrefixSegmentsWithContext will list segments.
func (*Storage) ListPrefixWithContext ¶ added in v1.0.0
func (s *Storage) ListPrefixWithContext(ctx context.Context, prefix string, pairs ...*types.Pair) (err error)
ListPrefixWithContext will return list a specific dir.
func (*Storage) Metadata ¶ added in v0.4.0
Metadata will return current storager's metadata.
This function will create a context by default.
func (*Storage) MetadataWithContext ¶ added in v0.6.0
func (s *Storage) MetadataWithContext(ctx context.Context, pairs ...*types.Pair) (meta info.StorageMeta, err error)
MetadataWithContext will return current storager's metadata.
func (*Storage) Move ¶ added in v0.4.0
Move will move an object in the service.
This function will create a context by default.
func (*Storage) MoveWithContext ¶ added in v0.6.0
func (s *Storage) MoveWithContext(ctx context.Context, src string, dst string, pairs ...*types.Pair) (err error)
MoveWithContext will move an object in the service.
func (*Storage) Reach ¶ added in v0.4.0
Reach will provide a way, which can reach the object.
This function will create a context by default.
func (*Storage) ReachWithContext ¶ added in v0.6.0
func (s *Storage) ReachWithContext(ctx context.Context, path string, pairs ...*types.Pair) (url string, err error)
ReachWithContext will provide a way, which can reach the object.
func (*Storage) Read ¶ added in v0.4.0
Read will read the file's data.
This function will create a context by default.
func (*Storage) ReadWithContext ¶ added in v0.6.0
func (s *Storage) ReadWithContext(ctx context.Context, path string, pairs ...*types.Pair) (rc io.ReadCloser, err error)
ReadWithContext will read the file's data.
func (*Storage) Stat ¶ added in v0.4.0
Stat will stat a path to get info of an object.
This function will create a context by default.
func (*Storage) StatWithContext ¶ added in v0.6.0
func (s *Storage) StatWithContext(ctx context.Context, path string, pairs ...*types.Pair) (o *types.Object, err error)
StatWithContext will stat a path to get info of an object.
func (*Storage) Statistical ¶ added in v0.4.0
Statistical will count service's statistics, such as Size, Count.
This function will create a context by default.
func (*Storage) StatisticalWithContext ¶ added in v0.6.0
func (s *Storage) StatisticalWithContext(ctx context.Context, pairs ...*types.Pair) (statistic info.StorageStatistic, err error)
StatisticalWithContext will count service's statistics, such as Size, Count.
func (*Storage) Write ¶ added in v0.4.0
Write will write data into a file.
This function will create a context by default.
func (*Storage) WriteIndexSegment ¶ added in v1.1.0
func (s *Storage) WriteIndexSegment(seg segment.Segment, r io.Reader, index int, size int64, pairs ...*types.Pair) (err error)
WriteIndexSegment will write a part into an index based segment.
This function will create a context by default.