An application-oriented unified storage layer for Golang.
- Production ready
- High performance
- Vendor lock free
- Basic operations across implemented storage services with the same API
- List: list all Storager in service
- Get: get a Storager via name
- Create: create a Storager
- Delete: delete a Storager
- Basic operations across all storage services with the same API
- Read: read file content
- Write: write content into file
- List: list files under a dir or prefix
- Stat: get file's metadata
- Delete: delete a file
- Metadata: get storage service's metadata
- Advanced operations across implemented storage services with the same API
- Copy: copy a file
- Move: move a file
- Reach: generate a public accesible url
- Statistical: get storage service's statistics
- Segment: Full support for Segment, aka, Multipart
- Metadata
This lib is in heavy development, break changes could be introduced at any time. All public interface or functions expected to be stable at v1.0.0
.
Install will go get
go get -u github.com/Xuanwo/storage
Import
import "github.com/Xuanwo/storage"
// Init a service.
srv, store, err := coreutils.Open("qingstor://hmac:test_access_key:test_secret_key@https:qingstor.com:443/test_bucket_name")
if err != nil {
log.Fatalf("service init failed: %v", err)
}
// Use Storager API to maintain data.
ch := make(chan *types.Object, 1)
defer close(ch)
err := store.List("prefix", pairs.WithFileFunc(func(*types.Object){
ch <- o
}))
if err != nil {
log.Printf("storager listdir failed: %v", err)
}
Service | Description | Status |
---|---|---|
azblob | Azure Blob storage | alpha (-segments, -unittests) |
cos | Tencent Cloud Object Storage | alpha (-segments, -unittests) |
dropbox | Dropbox | alpha (-unittests) |
fs | Local file system | stable (-segments) |
gcs | Google Cloud Storage | alpha (-segments, -unittests) |
kodo | qiniu kodo | alpha (-segments, -unittests) |
oss | Aliyun Object Storage | alpha (-segments, -unittests) |
qingstor | QingStor Object Storage | stable |
s3 | Amazon S3 | alpha (-segments, -unittests) |
uss | UPYUN Storage Service | alpha (-segments, -unittests) |
azblob://hmac:<access_key>:<secret_key>/<bucket_name>/<prefix>
cos://hmac:<access_key>:<secret_key>/<bucket_name>/<prefix>
dropbox://apikey:<api_key>/path/to/dir
fs:///path/to/dir
gcs://apikey:<api_key>/<bucket_name>/<prefix>?project=<project_id>
kodo://hmac:<access_key>:<secret_key>/<bucket_name>/<prefix>
oss://hmac:<access_key>:<secret_key>@<protocol>:<host>:<port>/<bucket_name>/<prefix>
qingstor://hmac:<access_key>:<secret_key>@<protocol>:<host>:<port>/<bucket_name>/<prefix>
s3://hmac:<access_key>:<secret_key>/<bucket_name>/<prefix>
uss://hmac:<access_key>:<secret_key>/<bucket_name>/<prefix>