(streamId: string)
| 81 | } |
| 82 | |
| 83 | export async function allocateCursor(streamId: string): Promise<{ |
| 84 | seq: number |
| 85 | cursor: string |
| 86 | }> { |
| 87 | const config = getStreamConfig() |
| 88 | const seq = await withRedisRetry({ operation: 'allocate_cursor', streamId }, async (redis) => { |
| 89 | const nextValue = await redis.incr(getSeqKey(streamId)) |
| 90 | await redis.expire(getSeqKey(streamId), config.ttlSeconds) |
| 91 | return typeof nextValue === 'number' ? nextValue : Number(nextValue) |
| 92 | }) |
| 93 | |
| 94 | return { seq, cursor: String(seq) } |
| 95 | } |
| 96 | |
| 97 | export async function resetBuffer(streamId: string): Promise<void> { |
| 98 | await clearBuffer(streamId, 'reset_outbox') |
no test coverage detected