Skip to content

Commit

Permalink
doc: add info about queue over rest and add to CLI help about queue c…
Browse files Browse the repository at this point in the history
…ommand usage
  • Loading branch information
reddec committed Dec 27, 2019
1 parent b905789 commit 9fbb28f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
21 changes: 21 additions & 0 deletions docs/cli/storages.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ Available commands:

See `storages <command> --help`

### Queues

```
Usage:
storages [OPTIONS] queue <command>
Application Options:
-u, --url= Storage URL (default: bbolt://data) [$URL]
-k, --key= Key in storage where configuration defined [$KEY]
-L, --lock= Optional lock file for inter-process synchronization [$LOCK]
Help Options:
-h, --help Show this help message
Available commands:
discard remove oldest data from queue (like silent get)
get get oldest data from queue and remove it (aliases: pop)
peek get oldest data from queue but not remove
put put data to the queue (aliases: push, append)
serve expose queue over REST interface (aliases: rest)
```


# Install
Expand Down
14 changes: 13 additions & 1 deletion docs/derived/queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@ import: `github.com/reddec/storages/queues`

Constructors:

* `Naive`
* `Naive`


## HTTP expose

It's possible to expose queue over HTTP by `NewServer(queue)`


| Method | Path | Success status | Description |
|----------|--------|----------------|-------------
| `GET` | `/` | 200 | Peek last message in queue (404 NotFound if queue is empty)
| `POST` | `/` | 204 | Add message to queue
| `DELETE` | `/` | 200 | Get last message from queue and remove it. Last message will be returned otherwise 404 not found

0 comments on commit 9fbb28f

Please sign in to comment.