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 IsBucketNameValid(s string) bool
- func New(pairs ...*types.Pair) (_ storage.Servicer, _ storage.Storager, err error)
- 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(id string, pairs ...*types.Pair) (err error)
- func (s *Storage) AbortSegmentWithContext(ctx context.Context, id string, pairs ...*types.Pair) (err error)
- func (s *Storage) CompleteSegment(id string, pairs ...*types.Pair) (err error)
- func (s *Storage) CompleteSegmentWithContext(ctx context.Context, id string, pairs ...*types.Pair) (err error)
- func (s *Storage) Copy(src, dst string, pairs ...*types.Pair) (err error)
- func (s *Storage) CopyWithContext(ctx context.Context, src, 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) InitSegment(path string, pairs ...*types.Pair) (id string, err error)
- func (s *Storage) InitSegmentWithContext(ctx context.Context, path string, pairs ...*types.Pair) (id string, err error)
- func (s *Storage) List(path string, pairs ...*types.Pair) (err error)
- func (s *Storage) ListSegments(path string, pairs ...*types.Pair) (err error)
- func (s *Storage) ListSegmentsWithContext(ctx context.Context, path string, pairs ...*types.Pair) (err error)
- func (s *Storage) ListWithContext(ctx context.Context, path string, pairs ...*types.Pair) (err error)
- func (s *Storage) Metadata(pairs ...*types.Pair) (m metadata.StorageMeta, err error)
- func (s *Storage) MetadataWithContext(ctx context.Context, pairs ...*types.Pair) (m metadata.StorageMeta, err error)
- func (s *Storage) Move(src, dst string, pairs ...*types.Pair) (err error)
- func (s *Storage) MoveWithContext(ctx context.Context, src, 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) (r io.ReadCloser, err error)
- func (s *Storage) ReadWithContext(ctx context.Context, path string, pairs ...*types.Pair) (r 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) (m metadata.StorageStatistic, err error)
- func (s *Storage) StatisticalWithContext(ctx context.Context, pairs ...*types.Pair) (m metadata.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) WriteSegment(id string, offset, size int64, r io.Reader, pairs ...*types.Pair) (err error)
- func (s *Storage) WriteSegmentWithContext(ctx context.Context, id string, offset, size int64, r io.Reader, ...) (err error)
- func (s *Storage) WriteWithContext(ctx context.Context, path string, r io.Reader, pairs ...*types.Pair) (err error)
Examples ¶
Constants ¶
const DirectoryContentType = "application/x-directory"
DirectoryContentType is the mime type that qingstor used for a directory.
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 IsBucketNameValid ¶ added in v0.3.0
IsBucketNameValid will check whether given string is a valid bucket name.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the qingstor service config.
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 adds context support for Create.
func (*Service) DeleteWithContext ¶ added in v0.6.0
func (s *Service) DeleteWithContext(ctx context.Context, name string, pairs ...*types.Pair) (err error)
DeleteWithContext adds context support for Delete.
func (*Service) Get ¶
Get implements Servicer.Get
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 adds context support for Get.
func (*Service) ListWithContext ¶ added in v0.6.0
ListWithContext adds context support for List.
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 implements Storager.AbortSegment
func (*Storage) AbortSegmentWithContext ¶ added in v0.6.0
func (s *Storage) AbortSegmentWithContext(ctx context.Context, id string, pairs ...*types.Pair) (err error)
AbortSegmentWithContext adds context support for AbortSegment.
func (*Storage) CompleteSegment ¶ added in v0.4.0
CompleteSegment implements Storager.CompleteSegment
func (*Storage) CompleteSegmentWithContext ¶ added in v0.6.0
func (s *Storage) CompleteSegmentWithContext(ctx context.Context, id string, pairs ...*types.Pair) (err error)
CompleteSegmentWithContext adds context support for CompleteSegment.
func (*Storage) CopyWithContext ¶ added in v0.6.0
func (s *Storage) CopyWithContext(ctx context.Context, src, dst string, pairs ...*types.Pair) (err error)
CopyWithContext adds context support for Copy.
func (*Storage) DeleteWithContext ¶ added in v0.6.0
func (s *Storage) DeleteWithContext(ctx context.Context, path string, pairs ...*types.Pair) (err error)
DeleteWithContext adds context support for Delete.
func (*Storage) InitSegment ¶ added in v0.4.0
InitSegment implements Storager.InitSegment
func (*Storage) InitSegmentWithContext ¶ added in v0.6.0
func (s *Storage) InitSegmentWithContext(ctx context.Context, path string, pairs ...*types.Pair) (id string, err error)
InitSegmentWithContext adds context support for InitSegment.
func (*Storage) ListSegments ¶ added in v0.4.0
ListSegments implements Storager.ListSegments
func (*Storage) ListSegmentsWithContext ¶ added in v0.6.0
func (s *Storage) ListSegmentsWithContext(ctx context.Context, path string, pairs ...*types.Pair) (err error)
ListSegmentsWithContext adds context support for ListSegments.
func (*Storage) ListWithContext ¶ added in v0.6.0
func (s *Storage) ListWithContext(ctx context.Context, path string, pairs ...*types.Pair) (err error)
ListWithContext adds context support for List.
func (*Storage) MetadataWithContext ¶ added in v0.6.0
func (s *Storage) MetadataWithContext(ctx context.Context, pairs ...*types.Pair) (m metadata.StorageMeta, err error)
MetadataWithContext adds context support for Metadata.
func (*Storage) MoveWithContext ¶ added in v0.6.0
func (s *Storage) MoveWithContext(ctx context.Context, src, dst string, pairs ...*types.Pair) (err error)
MoveWithContext adds context support for Move.
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 adds context support for Reach.
func (*Storage) ReadWithContext ¶ added in v0.6.0
func (s *Storage) ReadWithContext(ctx context.Context, path string, pairs ...*types.Pair) (r io.ReadCloser, err error)
ReadWithContext adds context support for Read.
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 adds context support for Stat.
func (*Storage) Statistical ¶ added in v0.4.0
Statistical implements Storager.Statistical
func (*Storage) StatisticalWithContext ¶ added in v0.6.0
func (s *Storage) StatisticalWithContext(ctx context.Context, pairs ...*types.Pair) (m metadata.StorageStatistic, err error)
StatisticalWithContext adds context support for Statistical.
func (*Storage) WriteSegment ¶ added in v0.4.0
func (s *Storage) WriteSegment(id string, offset, size int64, r io.Reader, pairs ...*types.Pair) (err error)
WriteSegment implements Storager.WriteSegment