Skip to content

Commit c576da6

Browse files
authored
docs: several grammar corrections to api v3 doc (#99)
1 parent c45cfab commit c576da6

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

api_v3.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ Method
4242
it will autofill by fetching etcd version if this option empty.
4343
- `ssl_verify`: boolean - whether to verify the etcd certificate when originating TLS connection with etcd (if you want to communicate to etcd with TLS connection, use `https` scheme in your `http_host`), default is `true.
4444

45-
The client methods returns either a `etcd` object or an `error string`.
45+
The client method returns either a `etcd` object or an `error string`.
4646

4747
```lua
4848
local cli, err = require("resty.etcd").new({protocol = "v3"})
4949
```
5050

51-
Please refer the **etcd API documentaion** at - https://github.com/coreos/etcd for more details.
51+
Please refer to the **etcd API documentaion** at - https://github.com/coreos/etcd for more details.
5252

5353
[Back to TOP](#api-v3)
5454

@@ -59,9 +59,9 @@ Please refer the **etcd API documentaion** at - https://github.com/coreos/etcd f
5959
* `key`: string value.
6060
* `opts`: optional options.
6161
* `timeout`: (int) request timeout seconds. set 0 to disable timeout.
62-
* `revision`: (int) revision is the point-in-time of the key-value store to use for the range. If revision is less or equal to zero, the range is over the newest key-value store. If the revision has been compacted, ErrCompacted is returned as a response.
62+
* `revision`: (int) revision is the point-in-time of the key-value store to use for the range. If revision is less than or equal to zero, the range is over the newest key-value store. If the revision has been compacted, ErrCompacted is returned as a response.
6363

64-
Gets the value for key.
64+
To get the value for key.
6565

6666
```lua
6767
local res, err = cli:get('/path/to/key')
@@ -82,7 +82,7 @@ local res, err = cli:get('/path/to/key')
8282
* `ignore_value`: (bool) If ignore_value is set, etcd updates the key using its current value. Returns an error if the key does not exist.
8383
* `ignore_lease`: (bool) If ignore_lease is set, etcd updates the key using its current lease. Returns an error if the key does not exist.
8484

85-
Set a key-value pair.
85+
To set a key-value pair.
8686

8787
```lua
8888
local res, err = cli:set('/path/to/key', 'val', 10)
@@ -99,7 +99,7 @@ local res, err = cli:set('/path/to/key', 'val', 10)
9999
* `opts`: optional options.
100100
* `timeout`: (int) request timeout seconds. set 0 to disable timeout.
101101

102-
Set a key-value pair if that key does not exist.
102+
To set a key-value pair if that key does not exist.
103103

104104
```lua
105105
local res, err = cli:setnx('/path/to/key', 'val', 10)
@@ -116,7 +116,7 @@ local res, err = cli:setnx('/path/to/key', 'val', 10)
116116
* `opts`: optional options.
117117
* `timeout`: (int) request timeout seconds. set 0 to disable timeout.
118118

119-
Set a key-value pair when that key is exists.
119+
To set a key-value pair when that key exists.
120120

121121
```lua
122122
local res, err = cli:setx('/path/to/key', 'val', 10)
@@ -133,7 +133,7 @@ local res, err = cli:setx('/path/to/key', 'val', 10)
133133
* `timeout`: (int) request timeout seconds. set 0 to disable timeout.
134134
* `prev_kv`: (bool) If prev_kv is set, etcd gets the previous key-value pairs before deleting it. The previous key-value pairs will be returned in the delete response.
135135

136-
Deletes a key-value pair.
136+
To delete a key-value pair.
137137

138138
```lua
139139
local res, err = cli:delete('/path/to/key')
@@ -153,11 +153,11 @@ local res, err = cli:delete('/path/to/key')
153153
* `progress_notify`: (bool) progress_notify is set so that the etcd server will periodically send a WatchResponse with no events to the new watcher if there are no recent events.
154154
* `filters`: (slice of (enum FilterType {NOPUT = 0;NODELETE = 1;})) filters filter the events at server side before it sends back to the watcher.
155155
* `prev_kv`: (bool) If prev_kv is set, created watcher gets the previous KV before the event happens. If the previous KV is already compacted, nothing will be returned.
156-
* `watch_id`: (int) If watch_id is provided and non-zero, it will be assigned to this watcher. Since creating a watcher in etcd is not a synchronous operation, this can be used ensure that ordering is correct when creating multiple watchers on the same stream. Creating a watcher with an ID already in use on the stream will cause an error to be returned.
156+
* `watch_id`: (int) If watch_id is provided and non-zero, it will be assigned to this watcher. Since creating a watcher in etcd is not a synchronous operation, this can be used to ensure that ordering is correct when creating multiple watchers on the same stream. Creating a watcher with an ID already in use on the stream will cause an error to be returned.
157157
* `fragment`: (bool) fragment enables splitting large revisions into multiple watch responses.
158158
* `need_cancel`: (bool) if watch need to be cancel, watch would return http_cli for further cancelation. See [watchcancel](#watchcancel) for detail.
159159

160-
Watch the update of key.
160+
To watch the update of key.
161161

162162
```lua
163163
local res, err = cli:watch('/path/to/key')
@@ -171,7 +171,7 @@ local res, err = cli:watch('/path/to/key')
171171

172172
* `http_cli`: the http client needs to revoke.
173173

174-
Cancel the watch before it got expired. Need to set `need_cancel` to get the http client for cancelation.
174+
To cancel the watch before it get expired. Need to set `need_cancel` to get the http client for cancelation.
175175

176176
```lua
177177
local res, err, http_cli = cli:watch('/path/to/key', {need_cancel = true})
@@ -187,14 +187,14 @@ res = cli:watchcancel(http_cli)
187187
* `key`: string value.
188188
* `opts`: optional options.
189189
* `timeout`: (int) request timeout seconds. set 0 to disable timeout.
190-
* `revision`: (int) revision is the point-in-time of the key-value store to use for the range. If revision is less or equal to zero, the range is over the newest key-value store. If the revision has been compacted, ErrCompacted is returned as a response.
190+
* `revision`: (int) revision is the point-in-time of the key-value store to use for the range. If revision is less than or equal to zero, the range is over the newest key-value store. If the revision has been compacted, ErrCompacted is returned as a response.
191191
* `limit`: (int) limit is a limit on the number of keys returned for the request. When limit is set to 0, it is treated as no limit.
192192
* `sort_order`: (int [SortNone:0, SortAscend:1, SortDescend:2]) sort_order is the order for returned sorted results.
193193
* `sort_target`: (int [SortByKey:0, SortByVersion:1, SortByCreateRevision:2, SortByModRevision:3, SortByValue:4]) sort_target is the key-value field to use for sorting.
194194
* `keys_only`: (bool) keys_only when set returns only the keys and not the values.
195195
* `count_only`: (bool) count_only when set returns only the count of the keys in the range.
196196

197-
Read the directory.
197+
To read the directory.
198198

199199
```lua
200200
local res, err = cli:readdir('/path/to/dir')
@@ -215,10 +215,10 @@ local res, err = cli:readdir('/path/to/dir')
215215
* `progress_notify`: (bool) progress_notify is set so that the etcd server will periodically send a WatchResponse with no events to the new watcher if there are no recent events.
216216
* `filters`: (slice of [enum FilterType {NOPUT = 0;NODELETE = 1;}]) filters filter the events at server side before it sends back to the watcher.
217217
* `prev_kv`: (bool) If prev_kv is set, created watcher gets the previous KV before the event happens. If the previous KV is already compacted, nothing will be returned.
218-
* `watch_id`: (int) If watch_id is provided and non-zero, it will be assigned to this watcher. Since creating a watcher in etcd is not a synchronous operation, this can be used ensure that ordering is correct when creating multiple watchers on the same stream. Creating a watcher with an ID already in use on the stream will cause an error to be returned.
218+
* `watch_id`: (int) If watch_id is provided and non-zero, it will be assigned to this watcher. Since creating a watcher in etcd is not a synchronous operation, this can be used to ensure that ordering is correct when creating multiple watchers on the same stream. Creating a watcher with an ID already in use on the stream will cause an error to be returned.
219219
* `fragment`: (bool) fragment enables splitting large revisions into multiple watch responses.
220220

221-
Watch the update of directory.
221+
To watch the update of directory.
222222

223223

224224
```lua
@@ -237,7 +237,7 @@ local res, err = cli:watchdir('/path/to/dir')
237237
* `timeout`: (int) request timeout seconds. set 0 to disable timeout.
238238
* `prev_kv`: (bool) If prev_kv is set, etcd gets the previous key-value pairs before deleting it. The previous key-value pairs will be returned in the delete response.
239239

240-
Remove the directory
240+
To remove the directory.
241241

242242
```lua
243243
local res, err = cli:rmdir('/path/to/dir')
@@ -256,7 +256,7 @@ local res, err = cli:rmdir('/path/to/dir')
256256
* `opts`: optional options.
257257
* `timeout`: (int) request timeout seconds. set 0 to disable timeout.
258258

259-
Transaction
259+
Transaction.
260260

261261
```lua
262262
local compare = {}
@@ -280,7 +280,7 @@ local res, err = cli:txn(compare, success, nil)
280280

281281
`syntax: res, err = cli:version()`
282282

283-
Gets the etcd version info.
283+
To get the etcd version info.
284284

285285
[Back to TOP](#api-v3)
286286

@@ -291,7 +291,7 @@ Gets the etcd version info.
291291
- `TTL`: advisory time-to-live in seconds.
292292
- `ID`: the requested ID for the lease. If ID is set to 0, the lessor chooses an ID.
293293

294-
Creates a lease which expires if the server does not receive a keepalive within a given time to live period. All keys attached to the lease will be expired and deleted if the lease expires. Each expired key generates a delete event in the event history.
294+
To create a lease which expires if the server does not receive a keepalive within a given time to live period. All keys attached to the lease will get expired and be deleted if the lease expires. Each expired key generates a delete event in the event history.
295295

296296
```lua
297297
-- grant a lease with 5 second TTL
@@ -309,7 +309,7 @@ local data, err = etcd:set('/path/to/key', 'val', {lease = res.body.ID})
309309

310310
- `ID`: the lease ID to revoke. When the ID is revoked, all associated keys will be deleted.
311311

312-
Revokes a lease. All keys attached to the lease will expire and be deleted.
312+
To revoke a lease. All keys attached to the lease will expire and be deleted.
313313

314314
```lua
315315
local res, err = cli:grant(5)
@@ -328,7 +328,7 @@ local data, err = cli:get('/path/to/key')
328328

329329
- `ID`: the lease ID for the lease to keep alive.
330330

331-
Keeps the lease alive by streaming keep alive requests from the client to the server and streaming keep alive responses from the server to the client.
331+
To keep the lease alive by streaming keep alive requests from the client to the server and streaming keep alive responses from the server to the client.
332332

333333
[Back to TOP](#api-v3)
334334

@@ -339,15 +339,15 @@ Keeps the lease alive by streaming keep alive requests from the client to the se
339339
- `ID`: the lease ID for the lease.
340340
- `keys`: if true, query all the keys attached to this lease.
341341

342-
Retrieves lease information.
342+
To retrieve lease information.
343343

344344
[Back to TOP](#api-v3)
345345

346346
### leases
347347

348348
`syntax: res, err = cli:leases()`
349349

350-
Lists all existing leases.
350+
To list all existing leases.
351351

352352
[Back to TOP](#api-v3)
353353

0 commit comments

Comments
 (0)