redis
Module[Redis]: documents stored in Redis.
Every key starts with utopia:{namespace}:{database}:
| Key | Type | Holds |
|---|---|---|
utopia:{ns}:dbs | SET | database names (per namespace) |
…:cols | SET | collection ids of the database |
…:meta:{col} | HASH | schema, attrs, indexes, docCount, sizeBytes |
…:doc:{col}:{id} | STRING | the document as JSON |
…:idx:{col} | SET | the ids of the collection's documents |
…:seq:{col} | STRING | the last $sequence given |
…:perm:{col}:{r|c|u|d|w}:{role} | SET | ids a role may act on |
…:perm:doc:{col}:{id} | HASH | role => its action letters |
Rust
use utopia_database::Adapter;
use utopia_database::adapter::redis::Redis;
let adapter = Redis::connect("redis://localhost:6379/3").await?;
adapter.set_database("appwrite")?;
adapter.set_namespace("_1")?;
adapter.create("appwrite").await?;Compiles in CI; needs a running service to execute.
Contents
3 submodules, and what the module defines itself.
Defined here
use utopia_database::adapter::redis::Redis;Rust
pub struct RedisThe Redis adapter. See the module docs.
Rust
pub const KEY_PREFIX: &str = "utopia"The prefix of every key (KEY_PREFIX).
Rust
pub const SEP: &str = ":"The separator of key segments (SEP).