Skip to content

Commit 52317a3

Browse files
committed
docs: regenerate
1 parent 4a00dad commit 52317a3

File tree

6 files changed

+527
-7
lines changed

6 files changed

+527
-7
lines changed

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,34 @@ Requires Redis 5 or greater.
66
## Getting Started
77

88
```javascript
9-
import streamEntries from 'redis-x-stream'
9+
import { RedisStream } from 'redis-x-stream'
10+
import Redis from 'ioredis'
1011

11-
for await (const [stream, [id, keyvals]] of streamEntries('myStream')) {
12-
//process an entry
12+
const myStream = 'my-stream'
13+
await populate(myStream, 1e5)
14+
15+
let i = 0
16+
for await (const [streamName, [id, keyvals]] of new RedisStream(myStream)) {
17+
i++;
18+
}
19+
console.log(`read ${i} stream entries from ${myStream}`)
20+
21+
async function populate(stream, count) {
22+
const writer = new Redis({ enableAutoPipelining: true })
23+
await Promise.all(
24+
Array.from(Array(count), (_, j) => writer.xadd(stream, '*', 'index', j))
25+
)
26+
writer.quit()
27+
await new Promise(resolve => writer.once('close', resolve))
28+
console.log(`wrote ${count} stream entries to ${stream}`)
1329
}
1430
```
1531
## Usage
1632

17-
See [API Docs](docs/classes/redisstream.md#constructor)
33+
See the [API Docs](docs/classes/RedisStream.md#constructor) for available options.
1834

35+
## Advanced Usage
1936

37+
A common use case for redis streams is task processing. This iterable abstraction can help with handling tasks _at least once_.
2038

21-
## Not yet implemented
22-
- batch mode
23-
- stream mode
39+
For example, You can immediately setup a group and consumer for any stream or streams.

docs/.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

docs/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
redis-x-stream / [Exports](modules.md)
2+
3+
# redis-x-stream
4+
5+
An [async iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator) that emits redis stream entries.
6+
Requires Redis 5 or greater.
7+
8+
## Getting Started
9+
10+
```javascript
11+
import { RedisStream } from 'redis-x-stream'
12+
import Redis from 'ioredis'
13+
14+
const myStream = 'my-stream'
15+
await populate(myStream, 1e5)
16+
17+
let i = 0
18+
for await (const [streamName, [id, keyvals]] of new RedisStream(myStream)) {
19+
i++;
20+
}
21+
console.log(`read ${i} stream entries from ${myStream}`)
22+
23+
async function populate(stream, count) {
24+
const writer = new Redis({ enableAutoPipelining: true })
25+
await Promise.all(
26+
Array.from(Array(count), (_, j) => writer.xadd(stream, '*', 'index', j))
27+
)
28+
writer.quit()
29+
await new Promise(resolve => writer.once('close', resolve))
30+
console.log(`wrote ${count} stream entries to ${stream}`)
31+
}
32+
```
33+
## Usage
34+
35+
See the [API Docs](docs/classes/RedisStream.md#constructor) for available options.

docs/classes/RedisStream.md

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
[redis-x-stream](../README.md) / [Exports](../modules.md) / RedisStream
2+
3+
# Class: RedisStream
4+
5+
## Table of contents
6+
7+
### Constructors
8+
9+
- [constructor](RedisStream.md#constructor)
10+
11+
### Properties
12+
13+
- [ackOnIterate](RedisStream.md#ackoniterate)
14+
- [block](RedisStream.md#block)
15+
- [buffers](RedisStream.md#buffers)
16+
- [client](RedisStream.md#client)
17+
- [consumer](RedisStream.md#consumer)
18+
- [count](RedisStream.md#count)
19+
- [deleteOnAck](RedisStream.md#deleteonack)
20+
- [done](RedisStream.md#done)
21+
- [first](RedisStream.md#first)
22+
- [group](RedisStream.md#group)
23+
- [noack](RedisStream.md#noack)
24+
- [pendingAcks](RedisStream.md#pendingacks)
25+
- [streams](RedisStream.md#streams)
26+
27+
### Methods
28+
29+
- [[asyncIterator]](RedisStream.md#[asynciterator])
30+
- [ack](RedisStream.md#ack)
31+
- [quit](RedisStream.md#quit)
32+
- [return](RedisStream.md#return)
33+
34+
## Constructors
35+
36+
### constructor
37+
38+
**new RedisStream**(`options`, ...`streams`)
39+
40+
#### Parameters
41+
42+
| Name | Type |
43+
| :------ | :------ |
44+
| `options` | `string` \| [`RedisStreamOptions`](../interfaces/RedisStreamOptions.md) |
45+
| `...streams` | `string`[] |
46+
47+
#### Defined in
48+
49+
[stream.ts:63](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L63)
50+
51+
## Properties
52+
53+
### ackOnIterate
54+
55+
**ackOnIterate**: `boolean` = `false`
56+
57+
#### Defined in
58+
59+
[stream.ts:35](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L35)
60+
61+
___
62+
63+
### block
64+
65+
`Optional` **block**: `number`
66+
67+
#### Defined in
68+
69+
[stream.ts:31](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L31)
70+
71+
___
72+
73+
### buffers
74+
75+
**buffers**: `boolean` = `false`
76+
77+
#### Defined in
78+
79+
[stream.ts:32](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L32)
80+
81+
___
82+
83+
### client
84+
85+
`Readonly` **client**: `Redis`
86+
87+
'entry' mode will dispense each entry of each stream
88+
'stream' mode will dispense each stream containing entries
89+
'batch' mode will dispense all streams with all entries
90+
91+
#### Defined in
92+
93+
[stream.ts:23](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L23)
94+
95+
___
96+
97+
### consumer
98+
99+
`Optional` `Readonly` **consumer**: `string`
100+
101+
#### Defined in
102+
103+
[stream.ts:25](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L25)
104+
105+
___
106+
107+
### count
108+
109+
**count**: `number` = `100`
110+
111+
#### Defined in
112+
113+
[stream.ts:29](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L29)
114+
115+
___
116+
117+
### deleteOnAck
118+
119+
**deleteOnAck**: `boolean` = `false`
120+
121+
#### Defined in
122+
123+
[stream.ts:36](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L36)
124+
125+
___
126+
127+
### done
128+
129+
**done**: `boolean` = `false`
130+
131+
Flag for iterable state
132+
133+
#### Defined in
134+
135+
[stream.ts:48](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L48)
136+
137+
___
138+
139+
### first
140+
141+
**first**: `boolean` = `false`
142+
143+
#### Defined in
144+
145+
[stream.ts:49](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L49)
146+
147+
___
148+
149+
### group
150+
151+
`Optional` `Readonly` **group**: `string`
152+
153+
#### Defined in
154+
155+
[stream.ts:24](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L24)
156+
157+
___
158+
159+
### noack
160+
161+
**noack**: `boolean` = `false`
162+
163+
#### Defined in
164+
165+
[stream.ts:30](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L30)
166+
167+
___
168+
169+
### pendingAcks
170+
171+
**pendingAcks**: `Map`<`string`, `string`[]\>
172+
173+
Acks waiting to be sent on either:
174+
- timeout
175+
- async iteration
176+
177+
#### Defined in
178+
179+
[stream.ts:44](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L44)
180+
181+
___
182+
183+
### streams
184+
185+
**streams**: `Map`<`string`, `string`\>
186+
187+
#### Defined in
188+
189+
[stream.ts:28](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L28)
190+
191+
## Methods
192+
193+
### [asyncIterator]
194+
195+
**[asyncIterator]**(): `AsyncIterator`<`XEntryResult`, `any`, `undefined`\>
196+
197+
#### Returns
198+
199+
`AsyncIterator`<`XEntryResult`, `any`, `undefined`\>
200+
201+
#### Defined in
202+
203+
[stream.ts:128](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L128)
204+
205+
___
206+
207+
### ack
208+
209+
**ack**(`stream`, ...`ids`): `undefined`
210+
211+
#### Parameters
212+
213+
| Name | Type |
214+
| :------ | :------ |
215+
| `stream` | `string` |
216+
| `...ids` | `string`[] |
217+
218+
#### Returns
219+
220+
`undefined`
221+
222+
#### Defined in
223+
224+
[stream.ts:185](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L185)
225+
226+
___
227+
228+
### quit
229+
230+
**quit**(): `Promise`<`void`\>
231+
232+
#### Returns
233+
234+
`Promise`<`void`\>
235+
236+
#### Defined in
237+
238+
[stream.ts:174](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L174)
239+
240+
___
241+
242+
### return
243+
244+
`Protected` **return**(): `Promise`<`void`\>
245+
246+
#### Returns
247+
248+
`Promise`<`void`\>
249+
250+
#### Defined in
251+
252+
[stream.ts:195](https://github.com/calebboyd/redis-x-stream/blob/4a00dad/src/stream.ts#L195)

0 commit comments

Comments
 (0)