Mastodon
#実装
Rails製のActivityPub実装。DBにPostgreSQL、CacheなどにRedisを採用している。
マストドンの名前は、絶滅した古代のゾウの種類に由来する。
初期は連合プロトコルとしてOStatusが利用されていたが、v1.6でActivityPubに対応、v2.0で非公開投稿がOStatusに流されなくなり、v3.0でActivityPubのみになった。
クライアントとの通信のためのMastodon APIは、Mastodon用のクライアントをそのまま使えるように、他のActivityPubサーバーでも採用されることが多い。
https://joinmastodon.org/
https://github.com/mastodon/mastodon
連合などの仕様書
https://docs.joinmastodon.org/ のサイドバーにある Spec compliance 辺りにある
ActivityPubに関連するコードの在処
ActivityPub固有の処理は概ね app/services/activitypub や app/workers/activitypub、 app/lib/activitypub あたりにある
例えばユーザー投稿は PostStatusService → ActivityPub::DistributionWorker → ActivityPub::DeliveryWorker と辿る。フォロワーへの配信はどれも似たような流れになる。
inboxでの受信は ActivityPub::InboxesController → ActivityPub::ProcessingWorker → ActivityPub::ProcessCollectionService → ActivityPub::Activity → 各種Activity のように。
#Ruby #Rails #PostgreSQL #Redis