Unverified Commit 28b78a8c authored by Hong Minhee's avatar Hong Minhee
Browse files

Mention @fedify/redis from docs

[ci skip]
parent 4310cf04
Loading
Loading
Loading
Loading
+22 −7
Original line number Diff line number Diff line
@@ -48,16 +48,24 @@ that the `Federation` object uses to store several kinds of cache data and
to maintain the queue of outgoing activities.

`KvStore` is an abstract interface that represents a key-value store.
Currently, there are two implementations of `KvStore`, which are the
For now, Fedify provides two built-in implementations of `KvStore`, which are
`MemoryKvStore` and `DenoKvStore` classes.  The `MemoryKvStore` class is for
testing and development purposes, and the `DenoKvStore` class is Deno KV-backed
implementation for production use (as you can guess from the name, it is only
available in Deno runtime).  However, you can define your own `KvStore`
implementation if you want to use a different key-value store.[^1]
available in Deno runtime).

As a separate package, [@fedify/redis] provides [`RedisKvStore`] class, which is
a Redis-backed implementation for production use.

You can define your own `KvStore` implementation if you want to use a different
key-value store.[^1]

[^1]: We are welcome to contributions of `KvStore` implementations for other
      key-value stores.

[@fedify/redis]: https://github.com/dahlia/fedify-redis
[`RedisKvStore`]: https://jsr.io/@fedify/redis/doc/kv/~/RedisKvStore

### `kvPrefixes`

The `~FederationParameters.kvPrefixes` property is an object that contains
@@ -82,13 +90,18 @@ If you don't provide this option, activities will not be queued and will
be sent immediately.

`MessageQueue` is an abstract interface that represents a message queue.
Currently, there are only two implementations of `MessageQueue`, which are
the `InProcessMessageQueue` and `DenoKvMessageQueue` classes.
For now, Fedify provides two built-in implementations of `MessageQueue`, which
are `InProcessMessageQueue` and `DenoKvMessageQueue` classes.
The `InProcessMessageQueue` class is for testing and development purposes,
and the `DenoKvMessageQueue` class is a Deno KV-backed implementation for
production use (as you can guess from the name, it is only available in Deno
runtime).  However, you can define your own `MessageQueue` implementation if
you want to use a different message queue.[^1]
runtime).

As a separate package, [@fedify/redis] provides [`RedisMessageQueue`] class,
which is a Redis-backed implementation for production use.

You can define your own `MessageQueue` implementation if you want to use
a different message queue.[^1]

> [!IMPORTANT]
> While the `queue` option is optional, it is highly recommended to provide
@@ -97,6 +110,8 @@ you want to use a different message queue.[^1]
> will be sent immediately.  This can make delivery of activities unreliable
> and can cause performance issues.

[`RedisMessageQueue`]: https://jsr.io/@fedify/redis/doc/mq/~/RedisMessageQueue

### `documentLoader`

A JSON-LD document loader function that the `Federation` object uses to
+4 −2
Original line number Diff line number Diff line
@@ -219,7 +219,8 @@ a key-value store.

> [!IMPORTANT]
> Since `MemoryKvStore` is for testing and development purposes, you should
> use a persistent key-value store like `DenoKvStore` for production use.
> use a persistent key-value store like `DenoKvStore` (in Deno) or
> [`RedisKvStore`] (from [@fedify/redis] package) for production use.

Then, we pass the incoming `Request` to the `Federation.fetch()` method:

@@ -307,7 +308,8 @@ to the next step.
> });
> ~~~~

[`Deno.openKv()`]: https://deno.land/api?s=Deno.openKv
[@fedify/redis]: https://github.com/dahlia/fedify-redis
[`RedisKvStore`]: https://jsr.io/@fedify/redis/doc/kv/~/RedisKvStore
[LogTape]: https://github.com/dahlia/logtape
[`configure()`]: https://jsr.io/@logtape/logtape/doc/~/configure