Expand description
A Redis backend for Ojak’s key-value store, RedisKvStore.
What Ojak keeps in its store — the IDs of activities already processed and forwarded, remote keys, fetched JSON-LD contexts — is then shared by every process using the same Redis, as a Mastodon server’s Redis is shared by its web and Sidekiq processes: an activity two processes receive at once is processed by one of them.
A key is its segments joined by :, after a prefix the application
gives, the way Redis keys are conventionally named, so that
["jsonld", "context", iri] is jsonld:context:<iri>, the key Mastodon
names that cache entry by. The prefix is put before the key as it is: an
application sharing one Redis between several instances gives each its own
prefix, such as "tenant-a:", and each a Redis user whose ACL reaches only
keys under it (~tenant-a:*). Joining is not escaped, so two keys whose
segments join to one string are one key; Ojak’s own keys never contain :
but in their last segment, which is what keeps them apart.
A value is stored as its JSON text, and a TTL as Redis’s own expiry, so
an expired entry is gone without anything sweeping it. The commands sent
are GET, SET (with PX and NX) and DEL, which is all a Redis user
for this store needs to be granted.
The deliverer’s circuit breakers can be kept here too, with
RedisBreakers, under the same kind of prefix, so that every process
delivering for an application counts the same failures.
Structs§
- Redis
Breakers - A
BreakerStorein Redis, which the deliverers of every process sharing it count their failures in, and let one probe through between, as Mastodon’s Sidekiq processes share their Stoplights. - Redis
KvStore - A
KvStorein Redis.
Enums§
- Probe
Release - How a probe’s lock is released.