Did you know ... Search Documentation:
Pack canny_tudor -- prolog/canny/redis.pl
PublicShow source
 redis_last_streams(+Reads, -Streams:list) is det
 redis_last_streams(+Reads, ?Tag, -Streams:dict) is det
Collates the last Streams for a given list of Reads, the reply from an XREAD command. The implementation assumes that each stream's read reply has one entry at least, else the stream does not present a reply.
 redis_last_stream_entry(+Entries, -StreamId, -Fields) is semidet
 redis_last_stream_entry(+Entries:list(list), -StreamId:atom, ?Tag:atom, -Fields:dict) is semidet
Unifies with the last StreamId and Fields. It fails for empty Entries. Each entry comprises a StreamId and a set of Fields.
 redis_keys_and_stream_ids(+Streams, ?Tag, -Keys, -StreamIds) is det
 redis_keys_and_stream_ids(+Pairs, -Keys, -StreamIds) is det
Streams or Pairs of Keys and StreamIds. Arity-3 exists with Tag in order to unify with a dictionary by Tag.
Arguments:
Streams- is a dictionary of stream identifiers, indexed by stream key.
Keys- is a list of stream keys.
StreamIds- is a list of corrected stream identifiers. The predicate applies redis_stream_id/3 to the incoming identifiers, allowing for arbitrary milliseconds-sequence pairs including implied missing zero sequence number.
 redis_stream_read(+Reads, -Key, -StreamId, -Fields) is nondet
 redis_stream_read(+Reads, -Key, -StreamId, ?Tag, -Fields) is nondet
Unifies with all Key, StreamId and array of Fields for all Reads.
Arguments:
Reads- is a list of [Key, Entries] lists, a list of lists. The sub-lists always have two items: the Key of the stream followed by another sub-list of stream entries.
 redis_stream_entry(+Entries, -StreamId, -Fields) is nondet
 redis_stream_entry(+Entries:list, -StreamId:pair(nonneg,nonneg), ?Tag:atom, -Fields:dict) is nondet
 redis_stream_entry(+Reads:list, -Key:atom, -StreamId:pair(nonneg,nonneg), ?Tag:atom, -Fields:dict) is nondet
Unifies non-deterministically with all Entries, or Fields dictionaries embedded with multi-stream Reads. Decodes the stream identifier and the Entry.
Arguments:
Entries- is a list of [StreamId, Fields] lists, another list of lists. Each sub-list describes an "entry" within the stream, a pairing between an identifier and some fields.
 redis_stream_id(?RedisTimeSeqPair) is semidet
 redis_stream_id(?StreamId:text, ?RedisTimeSeqPair) is semidet
 redis_stream_id(?StreamId:text, ?RedisTime:nonneg, ?Seq:nonneg) is semidet
Stream identifier to millisecond and sequence numbers. In practice, the numbers always convert to integers.

Deliberately validates incoming Redis time and sequence numbers. Both must be integers and both must be zero or more. The predicates fail otherwise. Internally, Redis stores stream identifiers as 128-bit unsigned integers split in half for the time and sequence values, each of 64 bits.

The 3-arity version of the predicate handles extraction of time and sequence integers from arbitrary stream identifiers: text or compound terms, including implied zero-sequence stream identifier with a single non-negative integer representing a millisecond Unix time.

Arguments:
StreamId- identifies a stream message or entry, element or item. All these terms apply to the contents of a stream, but Redis internally refers to the content as entries.
RedisTimeSeqPair- is a pair of non-negative integers, time and sequence. The Redis time equals Unix time multiplied by 1,000; in other words, Unix time in milliseconds.
 redis_time(+RedisTime) is semidet
Successful when RedisTime is a positive integer. Redis times amount to millisecond-scale Unix times.
Arguments:
RedisTime- in milliseconds since 1970.
 redis_date_time(+RedisTime, -DateTime, +TimeZone) is det
Converts RedisTime to DateTime within TimeZone.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 redis_last_streams(Arg1, Arg2, Arg3)
 redis_last_stream_entry(Arg1, Arg2, Arg3, Arg4)
 redis_keys_and_stream_ids(Arg1, Arg2, Arg3)
 redis_stream_read(Arg1, Arg2, Arg3, Arg4, Arg5)
 redis_stream_entry(Arg1, Arg2, Arg3, Arg4)
 redis_stream_id(Arg1, Arg2)
 redis_stream_id(Arg1, Arg2, Arg3)