garnet
garnet copied to clipboard
STREAMS API in Garnet
Adds support for STREAMS in Garnet.
Index Structure
Uses an in-memory B+tree (B-tree) index that has the following features:
- Fast insertions through the tail leaf node of the index, taking advantage of sorted data input.
- Maximizes leaf occupancy, taking advantage of sorted data input.
- Uses tombstones for deletes.
- Supports forward and reverse range scans.
Supported Operations in API
The following operations are currently supported:
- XADD - add using auto-generated id and user-defined id. Does not currently support [NOMKSTREAM], [MAXLEN], [MINID] and [threshold]
- XLEN
- XRANGE
- XDEL
STREAMID
Stream ID is a 128-bit ID for an entry in the Stream that is of a format ts-seq where ts is generally the timestamp and seq is the sequence number.
STREAM
The Stream Object that consists of an instance to its B-tree index and a Tsavorite log instance for persistence. Every entry added to a Stream is first inserted into the Tsavorite log that returns the added address. This address is added as the value to the index using the STREAMID as key.
StreamManager
A container/wrapper that holds all Streams in the server in a dictionary.
SessionStreamCache
A local cache of Streams added by the client for faster access. Currently capped at capacity and uses a simple FIFO policy for the initial version. Can be extended to support other eviction strategies (preferably LRU).
Two nits:
- FLUSHDB/FLUSHALL should clear the sequence number.
- Return value is bulk string, not simple string.
Run dotnet format at the command line to get rid of formatting errors.
@microsoft-github-policy-service agree company="Microsoft"
Is closing this intentional? A tracking PR could be useful for this...
I'm also interested in it's status, streams allows us to use KEDA scaling in K8