Skip to content

Commit f32b0dc

Browse files
authored
storage: Implement proposal Object Mode (#22)
* storage: Implement proposal Object Mode Signed-off-by: Xuanwo <github@xuanwo.io> * Update tests Signed-off-by: Xuanwo <github@xuanwo.io> * update to fit go-storage change Signed-off-by: Xuanwo <github@xuanwo.io> * sort header Signed-off-by: Xuanwo <github@xuanwo.io> * Update deps Signed-off-by: Xuanwo <github@xuanwo.io> * Fix CI Signed-off-by: Xuanwo <github@xuanwo.io>
1 parent 8715e51 commit f32b0dc

File tree

8 files changed

+198
-563
lines changed

8 files changed

+198
-563
lines changed

generated.go

Lines changed: 89 additions & 205 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ go 1.14
44

55
require (
66
bou.ke/monkey v1.0.2
7-
github.com/aos-dev/go-integration-test/v2 v2.0.0-20210112071015-339e9258b7b2
8-
github.com/aos-dev/go-storage/v2 v2.0.1-0.20210113064536-aa4609f17d49
7+
github.com/aos-dev/go-integration-test/v2 v2.0.0-20210116105857-6da26dd14f81
8+
github.com/aos-dev/go-storage/v2 v2.0.1-0.20210115064600-bce000125e85
99
github.com/golang/mock v1.4.4
10-
github.com/google/uuid v1.1.4
10+
github.com/google/uuid v1.1.5
1111
github.com/pengsrc/go-shared v0.2.1-0.20190131101655-1999055a4a14
1212
github.com/qingstor/qingstor-sdk-go/v4 v4.2.0
13-
github.com/stretchr/testify v1.6.1
13+
github.com/stretchr/testify v1.7.0
1414
)

go.sum

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ github.com/Xuanwo/templateutils v0.0.0-20201019101431-c73b871118f2 h1:ydpBZm38sX
66
github.com/Xuanwo/templateutils v0.0.0-20201019101431-c73b871118f2/go.mod h1:x0qS7gfgEm24b8V9U+0zBEBAu/VpxZhO/+EWtpgEgDw=
77
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
88
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
9-
github.com/aos-dev/go-integration-test/v2 v2.0.0-20210112071015-339e9258b7b2 h1:gBe610/EhKOJKDay1jGzJXY/+OdxJ0at0ukAO7lDF5I=
10-
github.com/aos-dev/go-integration-test/v2 v2.0.0-20210112071015-339e9258b7b2/go.mod h1:/QyyTGYulgbdZr0smf9PPWsSplLp7ULbZe2zBTk5ycA=
11-
github.com/aos-dev/go-storage/v2 v2.0.1-0.20210112061652-0b7e2ab57b88/go.mod h1:6mNwhRUOEiBFebskENkrfQPljurlnBY87sRl4VynWZY=
12-
github.com/aos-dev/go-storage/v2 v2.0.1-0.20210113064536-aa4609f17d49 h1:DDl5LHlCWTymVQtWE1Tt5pJEPk860zJq3wEfYSi4vhY=
13-
github.com/aos-dev/go-storage/v2 v2.0.1-0.20210113064536-aa4609f17d49/go.mod h1:w7otbLlURX8eTUZ3Tt5i4K+JgFV5Z2MHZIwPA4C9OMM=
14-
github.com/aos-dev/specs/go v0.0.0-20210112040534-0e8e3c366e28/go.mod h1:lJ9DsZG2t1cMcn4DiUqfbGoKoyUgF+TOC4R5YVyqhns=
15-
github.com/aos-dev/specs/go v0.0.0-20210112094331-2b41a869cf25 h1:+mQ4n9Jx57vrDbWM/8VJlfc3IYYbyueAm+akB7FIarY=
16-
github.com/aos-dev/specs/go v0.0.0-20210112094331-2b41a869cf25/go.mod h1:lJ9DsZG2t1cMcn4DiUqfbGoKoyUgF+TOC4R5YVyqhns=
9+
github.com/aos-dev/go-integration-test/v2 v2.0.0-20210116105857-6da26dd14f81 h1:AXK2hDKhbY+y3xK1VMpdaF2qZD4kvsb94w2qWZHBoaI=
10+
github.com/aos-dev/go-integration-test/v2 v2.0.0-20210116105857-6da26dd14f81/go.mod h1:GC+v4fTcMUHxFRutZCjb1RPpE9/2Nn67M+ytIWHay/Q=
11+
github.com/aos-dev/go-storage/v2 v2.0.1-0.20210115064600-bce000125e85 h1:78u0ZdWeAWYgqynI1LVq+v4Lznd1x53+9RwcqL55tRE=
12+
github.com/aos-dev/go-storage/v2 v2.0.1-0.20210115064600-bce000125e85/go.mod h1:yDX/BMgdQeKKBnaqwgfk1jMnxGj+nKsRKxRj0uIcKYU=
13+
github.com/aos-dev/specs/go v0.0.0-20210115050339-600fe76f7784 h1:T6UARjsuAQv8cky0itpS1Bdhq+cbtmM7Ss1xPGPylAw=
14+
github.com/aos-dev/specs/go v0.0.0-20210115050339-600fe76f7784/go.mod h1:33hICDZmcWeWivpjLEiBl7uiTXrO1xqTcbm4fwSRVPM=
1715
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
1816
github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0=
1917
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
@@ -36,8 +34,8 @@ github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
3634
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
3735
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
3836
github.com/google/pprof v0.0.0-20181127221834-b4f47329b966/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
39-
github.com/google/uuid v1.1.4 h1:0ecGp3skIrHWPNGPJDaBIghfA6Sp7Ruo2Io8eLKzWm0=
40-
github.com/google/uuid v1.1.4/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
37+
github.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I=
38+
github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
4139
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
4240
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
4341
github.com/hashicorp/hcl/v2 v2.8.2 h1:wmFle3D1vu0okesm8BTLVDyJ6/OL9DCLUwn0b2OptiY=
@@ -73,8 +71,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
7371
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
7472
github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
7573
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
76-
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
77-
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
74+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
75+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
7876
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
7977
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
8078
github.com/zclconf/go-cty v1.2.0 h1:sPHsy7ADcIZQP3vILvTjrh74ZA175TFP5vqiNK1UmlI=

iterator.go

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,20 @@ import (
55
)
66

77
type objectPageStatus struct {
8-
delimiter string
9-
limit int
10-
marker string
11-
prefix string
8+
delimiter string
9+
limit int
10+
marker string
11+
prefix string
12+
partIdMarker string
1213
}
1314

1415
func (i *objectPageStatus) ContinuationToken() string {
16+
if i.partIdMarker != "" {
17+
return i.marker + "/" + i.partIdMarker
18+
}
1519
return i.marker
1620
}
1721

18-
type segmentPageStatus struct {
19-
delimiter string
20-
keyMarker string
21-
limit int
22-
prefix string
23-
uploadIdMarker string
24-
}
25-
26-
func (i *segmentPageStatus) ContinuationToken() string {
27-
return i.keyMarker + "/" + i.uploadIdMarker
28-
}
29-
3022
type storagePageStatus struct {
3123
limit int
3224
offset int

service.hcl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ namespace "service" {
2121
}
2222
}
2323
namespace "storage" {
24-
implement = ["copier", "fetcher", "index_segmenter", "mover", "reacher", "segmenter", "statistician"]
24+
implement = ["copier", "fetcher", "mover", "multiparter", "reacher", "statistician"]
2525

2626
new {
2727
required = ["name"]
2828
optional = ["disable_uri_cleaning", "http_client_options", "location", "pair_policy", "work_dir"]
2929
}
3030

31+
op "delete" {
32+
optional = ["part_id"]
33+
}
3134
op "list" {
32-
optional = ["list_type"]
35+
optional = ["list_mode"]
3336
}
3437
op "reach" {
3538
required = ["expire"]
@@ -38,12 +41,8 @@ namespace "storage" {
3841
optional = ["offset", "read_callback_func", "size"]
3942
}
4043
op "write" {
41-
required = ["size"]
4244
optional = ["content_md5", "content_type", "offset", "read_callback_func", "storage_class"]
4345
}
44-
op "write_index_segment" {
45-
optional = ["read_callback_func"]
46-
}
4746
}
4847

4948
pairs {

0 commit comments

Comments
 (0)