mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
22 lines
730 B
C
22 lines
730 B
C
|
#ifndef STREAM_H
|
||
|
#define STREAM_H
|
||
|
|
||
|
#include "rax.h"
|
||
|
|
||
|
/* Stream item ID: a 128 bit number composed of a milliseconds time and
|
||
|
* a sequence counter. IDs generated in the same millisecond (or in a past
|
||
|
* millisecond if the clock jumped backward) will use the millisecond time
|
||
|
* of the latest generated ID and an incremented sequence. */
|
||
|
typedef struct streamID {
|
||
|
uint64_t ms; /* Unix time in milliseconds. */
|
||
|
uint64_t seq; /* Sequence number. */
|
||
|
} streamID;
|
||
|
|
||
|
typedef struct stream {
|
||
|
rax *rax; /* The radix tree holding the stream. */
|
||
|
uint64_t length; /* Number of elements inside this stream. */
|
||
|
streamID last_id; /* Zero if there are yet no items. */
|
||
|
} stream;
|
||
|
|
||
|
#endif
|