forked from beyondstorage/go-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
operations.toml
303 lines (237 loc) · 8.03 KB
/
operations.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
[appender]
description = "is the interface for Append related operations."
[appender.op.create_append]
params = ["path"]
results = ["o"]
description = """
will create an append object.
## Behavior
- CreateAppend SHOULD create an appendable object with position 0 and size 0.
- CreateAppend SHOULD NOT return an error as the object exist.
- Service SHOULD check and delete the object if exists.
"""
[appender.op.write_append]
description = "will append content to an append object."
params = ["o", "r", "size"]
results = ["n"]
object_mode = "append"
[appender.op.commit_append]
description = "will commit and finish an append process."
params = ["o"]
object_mode = "append"
[blocker]
description = "is the interface for Block related operations."
[blocker.op.create_block]
params = ["path"]
results = ["o"]
description = """
will create a new block object.
## Behavior
- CreateBlock SHOULD NOT return an error as the object exist.
- Service that has native support for `overwrite` doesn't NEED to check the object exists or not.
- Service that doesn't have native support for `overwrite` SHOULD check and delete the object if exists.
"""
[blocker.op.write_block]
description = "will write content to a block."
params = ["o", "r", "size", "bid"]
results = ["n"]
object_mode = "block"
[blocker.op.combine_block]
description = "will combine blocks into an object."
params = ["o", "bids"]
object_mode = "block"
[blocker.op.list_block]
description = "will list blocks belong to this object."
params = ["o"]
results = ["bi"]
object_mode = "block"
[copier]
description = "is the interface for Copy."
[copier.op.copy]
params = ["src", "dst"]
description = """
will copy an Object or multiple object in the service.
## Behavior
- Copy only copy one and only one object.
- Service DON'T NEED to support copy a non-empty directory or copy files recursively.
- User NEED to implement copy a non-empty directory and copy recursively by themself.
- Copy a file to a directory SHOULD return `ErrObjectModeInvalid`.
- Copy SHOULD NOT return an error as dst object exists.
- Service that has native support for `overwrite` doesn't NEED to check the dst object exists or not.
- Service that doesn't have native support for `overwrite` SHOULD check and delete the dst object if exists.
- A successful copy opration should be complete, which means the dst object's content and metadata should be the same as src object.
"""
[direr]
description = "is the interface for Directory."
[direr.op.create_dir]
description = "will create a new dir object."
params = ["path"]
results = ["o"]
[fetcher]
description = "is the interface for Fetch."
[fetcher.op.fetch]
params = ["path", "url"]
description = """
will fetch from a given url to path.
## Behavior
- Fetch SHOULD NOT return an error as the object exists.
- A successful fetch operation should be complete, which means the object's content and metadata should be the same as requiring from the url.
"""
[mover]
description = "is the interface for Move."
[mover.op.move]
params = ["src", "dst"]
description = """
will move an object in the service.
## Behavior
- Move only move one and only one object.
- Service DON'T NEED to support move a non-empty directory.
- User NEED to implement move a non-empty directory by themself.
- Move a file to a directory SHOULD return `ErrObjectModeInvalid`.
- Move SHOULD NOT return an error as dst object exists.
- Service that has native support for `overwrite` doesn't NEED to check the dst object exists or not.
- Service that doesn't have native support for `overwrite` SHOULD check and delete the dst object if exists.
- A successful move operation SHOULD be complete, which means the dst object's content and metadata should be the same as src object.
"""
[multiparter]
description = "is the interface for Multipart related operations."
[multiparter.op.create_multipart]
params = ["path"]
results = ["o"]
description = """
will create a new multipart.
## Behavior
- CreateMultipart SHOULD NOT return an error as the object exists.
"""
[multiparter.op.write_multipart]
description = "will write content to a multipart."
params = ["o", "r", "size", "index"]
results = ["n", "part"]
object_mode = "part"
[multiparter.op.complete_multipart]
description = "will complete a multipart upload and construct an Object."
params = ["o", "parts"]
object_mode = "part"
[multiparter.op.list_multipart]
description = "will list parts belong to this multipart."
params = ["o"]
results = ["pi"]
object_mode = "part"
[pager]
description = "is the interface for Page related operations which support random write."
[pager.op.create_page]
params = ["path"]
results = ["o"]
description = """
will create a new page object.
## Behavior
- CreatePage SHOULD NOT return an error as the object exists.
"""
[pager.op.write_page]
description = "will write content to specific offset."
params = ["o", "r", "size", "offset"]
results = ["n"]
object_mode = "page"
[reacher]
description = "is the interface for Reach."
[reacher.op.reach]
description = "will provide a way, which can reach the object."
params = ["path"]
results = ["url"]
[servicer]
description = "can maintain multipart storage services."
[servicer.op.create]
description = "will create a new storager instance."
params = ["name"]
results = ["store"]
[servicer.op.delete]
description = "will delete a storager instance."
params = ["name"]
[servicer.op.get]
description = "will get a valid storager instance for service."
params = ["name"]
results = ["store"]
[servicer.op.list]
description = "will list all storager instances under this service."
results = ["sti"]
[storager]
description = "is the interface for storage service."
[storager.op.delete]
params = ["path"]
pairs = ["object_mode"]
description = """
will delete an object from service.
## Behavior
- Delete only delete one and only one object.
- Service DON'T NEED to support remove all.
- User NEED to implement remove_all by themself.
- Delete is idempotent.
- Successful delete always return nil error.
- Delete SHOULD never return `ObjectNotExist`
- Delete DON'T NEED to check the object exist or not.
"""
[storager.op.metadata]
description = "will return current storager metadata."
results = ["meta"]
local = true
[storager.op.list]
params = ["path"]
pairs = ["list_mode"]
results = ["oi"]
description = """
will return list a specific path.
## Behavior
- Service SHOULD support default `ListMode`.
- Service SHOULD implement `ListModeDir` without the check for `VirtualDir`.
- Service DON'T NEED to `Stat` while in `List`.
"""
[storager.op.read]
description = "will read the file's data."
params = ["path", "w"]
pairs = ["size", "offset", "io_callback"]
results = ["n"]
[storager.op.create]
params = ["path"]
results = ["o"]
pairs = ["object_mode"]
local = true
description = """
will create a new object without any api call.
## Behavior
- Create SHOULD NOT send any API call.
- Create SHOULD accept ObjectMode pair as object mode.
"""
[storager.op.stat]
params = ["path"]
pairs = ["object_mode"]
results = ["o"]
description = """
will stat a path to get info of an object.
## Behavior
- Stat SHOULD accept ObjectMode pair as hints.
- Service COULD have different implementations for different object mode.
- Service SHOULD check if returning ObjectMode is match
"""
[storager.op.write]
params = ["path", "r", "size"]
pairs = ["io_callback"]
results = ["n"]
description = """
will write data into a file.
## Behavior
- Write SHOULD NOT return an error as the object exist.
- Service that has native support for `overwrite` doesn't NEED to check the object exists or not.
- Service that doesn't have native support for `overwrite` SHOULD check and delete the object if exists.
- A successful write operation SHOULD be complete, which means the object's content and metadata should be the same as specified in write request.
"""
[linker]
description = "is the interface for link"
[linker.op.create_link]
params = ["path", "target"]
results = ["o"]
description = """
Will create a link object.
# Behavior
- CreateLink COULD implement virtual_link feature when service without native support.
- Users SHOULD enable this feature by themselves
"""