Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

feat: Initial Implementation of Storager #3

Merged
merged 1 commit into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
469 changes: 443 additions & 26 deletions generated.go

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module github.com/beyondstorage/go-service-example
module github.com/beyondstorage/go-service-obs

go 1.15

require github.com/beyondstorage/go-storage/v4 v4.6.0
require (
github.com/beyondstorage/go-endpoint v1.1.0
github.com/beyondstorage/go-storage/v4 v4.6.0
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.1+incompatible
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/Xuanwo/templateutils v0.1.0 h1:WpkWOqQtIQ2vAIpJLa727DdN8WtxhUkkbDGa6UhntJY=
github.com/Xuanwo/templateutils v0.1.0/go.mod h1:OdE0DJ+CJxDBq6psX5DPV+gOZi8bhuHuVUpPCG++Wb8=
github.com/beyondstorage/go-endpoint v1.1.0 h1:cpjmQdrAMyaLoT161NIFU/eXcsuMI3xViycid5/mBZg=
github.com/beyondstorage/go-endpoint v1.1.0/go.mod h1:P2hknaGrziOJJKySv/XnAiVw/d3v12/LZu2gSxEx4nM=
github.com/beyondstorage/go-storage/v4 v4.6.0 h1:a05dtbYjMZB7LrUSvVzzHwlx33B4yEmd5oQB7Itk7VY=
github.com/beyondstorage/go-storage/v4 v4.6.0/go.mod h1:mc9VzBImjXDg1/1sLfta2MJH79elfM6m47ZZvZ+q/Uw=
github.com/dave/dst v0.26.2 h1:lnxLAKI3tx7MgLNVDirFCsDTlTG9nKTk7GcptKcWSwY=
Expand All @@ -11,9 +13,13 @@ github.com/dave/rebecca v0.9.1/go.mod h1:N6XYdMD/OKw3lkF3ywh8Z6wPGuwNFDNtWYEMFWE
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/google/pprof v0.0.0-20181127221834-b4f47329b966/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.1+incompatible h1:EFjtiulITiEktaZrr0OPlymTmrlpvSAa/xvv08kTQEU=
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.1+incompatible/go.mod h1:l7VUhRbTKCzdOacdT4oWCwATKyvZqUOlOqr0Ous3k4s=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/kevinburke/go-bindata v3.22.0+incompatible h1:/JmqEhIWQ7GRScV0WjX/0tqBrC5D21ALg0H0U/KZ/ts=
github.com/kevinburke/go-bindata v3.22.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM=
Expand Down
12 changes: 12 additions & 0 deletions iterator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package obs

type objectPageStatus struct {
prefix string
maxKeys int
delimiter string
marker string
}

func (i *objectPageStatus) ContinuationToken() string {
return i.marker
}
23 changes: 23 additions & 0 deletions service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package obs

import (
"context"

. "github.com/beyondstorage/go-storage/v4/types"
)

func (s *Service) create(ctx context.Context, name string, opt pairServiceCreate) (store Storager, err error) {
panic("not implemented")
}

func (s *Service) delete(ctx context.Context, name string, opt pairServiceDelete) (err error) {
panic("not implemented")
}

func (s *Service) get(ctx context.Context, name string, opt pairServiceGet) (store Storager, err error) {
panic("not implemented")
}

func (s *Service) list(ctx context.Context, opt pairServiceList) (sti *StoragerIterator, err error) {
panic("not implemented")
}
35 changes: 34 additions & 1 deletion service.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
name = "obs"

[namespace.service]

[namespace.service.new]
required = ["credential", "endpoint"]
optional = ["service_features", "default_service_pairs"]

[namespace.storage]
features = ["virtual_dir"]

[namespace.storage.new]
required = ["name"]
optional = ["storage_features", "default_storage_pairs", "work_dir"]

[namespace.storage.op.create]
optional = ["object_mode"]
Expand All @@ -18,4 +29,26 @@ optional = ["offset", "io_callback", "size"]
optional = ["object_mode"]

[namespace.storage.op.write]
optional = ["content_md5", "content_type", "io_callback"]
optional = ["content_md5", "content_type", "io_callback", "storage_class"]

[pairs.service_features]
type = "ServiceFeatures"
description = "set service features"

[pairs.default_service_pairs]
type = "DefaultServicePairs"
description = "set default pairs for service actions"

[pairs.storage_features]
type = "StorageFeatures"
description = "set storage features"

[pairs.default_storage_pairs]
type = "DefaultStoragePairs"
description = "set default pairs for storage actions"

[pairs.storage_class]
type = "string"

[infos.object.meta.storage-class]
type = "string"
Loading