1
0
Fork 0

Minor documentation rewording

This commit is contained in:
Cadence Ember 2024-01-16 16:00:33 +13:00
parent 7d4379a099
commit b060451baf
3 changed files with 8 additions and 8 deletions

View file

@ -22,7 +22,7 @@ const ks = sync.require("../../matrix/kstate")
const inflightSpaceCreate = new Map() const inflightSpaceCreate = new Map()
/** /**
* @param {import("discord-api-types/v10").RESTGetAPIGuildResult} guild * @param {DiscordTypes.RESTGetAPIGuildResult} guild
* @param {any} kstate * @param {any} kstate
*/ */
async function createSpace(guild, kstate) { async function createSpace(guild, kstate) {
@ -199,7 +199,7 @@ async function syncSpaceFully(guildID) {
} }
/** /**
* @param {import("discord-api-types/v10").GatewayGuildEmojisUpdateDispatchData | import("discord-api-types/v10").GatewayGuildStickersUpdateDispatchData} data * @param {DiscordTypes.GatewayGuildEmojisUpdateDispatchData | DiscordTypes.GatewayGuildStickersUpdateDispatchData} data
* @param {boolean} checkBeforeSync false to always send new state, true to check the current state and only apply if state would change * @param {boolean} checkBeforeSync false to always send new state, true to check the current state and only apply if state would change
*/ */
async function syncSpaceExpressions(data, checkBeforeSync) { async function syncSpaceExpressions(data, checkBeforeSync) {
@ -209,11 +209,11 @@ async function syncSpaceExpressions(data, checkBeforeSync) {
if (!spaceID) return if (!spaceID) return
/** /**
* @typedef {import("discord-api-types/v10").GatewayGuildEmojisUpdateDispatchData & import("discord-api-types/v10").GatewayGuildStickersUpdateDispatchData} Expressions * @typedef {DiscordTypes.GatewayGuildEmojisUpdateDispatchData & DiscordTypes.GatewayGuildStickersUpdateDispatchData} Expressions
* @param {string} spaceID * @param {string} spaceID
* @param {Expressions extends any ? keyof Expressions : never} key * @param {Expressions extends any ? keyof Expressions : never} key
* @param {string} eventKey * @param {string} eventKey
* @param {(emojis: any[]) => any} fn * @param {typeof expression["emojisToState"] | typeof expression["stickersToState"]} fn
*/ */
async function update(spaceID, key, eventKey, fn) { async function update(spaceID, key, eventKey, fn) {
if (!(key in data) || !data[key].length) return if (!(key in data) || !data[key].length) return

View file

@ -437,7 +437,7 @@ async function messageToEvent(message, guild, options = {}, di) {
// Then embeds // Then embeds
for (const embed of message.embeds || []) { for (const embed of message.embeds || []) {
if (embed.type === "image") { if (embed.type === "image") {
continue // Matrix's own image embeds are fine. continue // Matrix's own URL previews are fine for images.
} }
// Start building up a replica ("rep") of the embed in Discord-markdown format, which we will convert into both plaintext and formatted body at once // Start building up a replica ("rep") of the embed in Discord-markdown format, which we will convert into both plaintext and formatted body at once

View file

@ -53,7 +53,7 @@ For more information about features, [see the user guide.](https://gitdab.com/ca
## Efficiency details ## Efficiency details
Using WeatherStack as a thin layer between the bridge application and the Discord API lets us control exactly what data is cached. Only necessary information is cached. For example, member data, user data, message content, and past edits are never stored in memory. This keeps the memory usage low and also prevents it ballooning in size over the bridge's runtime. Using WeatherStack as a thin layer between the bridge application and the Discord API lets us control exactly what data is cached in memory. Only necessary information is cached. For example, member data, user data, message content, and past edits are never stored in memory. This keeps the memory usage low and also prevents it ballooning in size over the bridge's runtime.
The bridge uses a small SQLite database to store relationships like which Discord messages correspond to which Matrix messages. This is so the bridge knows what to edit when some message is edited on Discord. Using `without rowid` on the database tables stores the index and the data in the same B-tree. Since Matrix and Discord's internal IDs are quite long, this vastly reduces storage space because those IDs do not have to be stored twice separately. Some event IDs are actually stored as xxhash integers to reduce storage requirements even more. On my personal instance of OOYE, every 100,000 messages require 16.1 MB of storage space in the SQLite database. The bridge uses a small SQLite database to store relationships like which Discord messages correspond to which Matrix messages. This is so the bridge knows what to edit when some message is edited on Discord. Using `without rowid` on the database tables stores the index and the data in the same B-tree. Since Matrix and Discord's internal IDs are quite long, this vastly reduces storage space because those IDs do not have to be stored twice separately. Some event IDs are actually stored as xxhash integers to reduce storage requirements even more. On my personal instance of OOYE, every 100,000 messages require 16.1 MB of storage space in the SQLite database.
@ -61,11 +61,11 @@ Only necessary data and columns are queried from the database. We only contact t
File uploads (like avatars from bridged members) are checked locally and deduplicated. Only brand new files are uploaded to the homeserver. This saves loads of space in the homeserver's media repo, especially for Synapse. File uploads (like avatars from bridged members) are checked locally and deduplicated. Only brand new files are uploaded to the homeserver. This saves loads of space in the homeserver's media repo, especially for Synapse.
Switching to [WAL mode](https://www.sqlite.org/wal.html) could improve your database access speed even more. Run `node scripts/wal.js` if you want to switch to WAL mode. Switching to [WAL mode](https://www.sqlite.org/wal.html) could improve your database access speed even more. Run `node scripts/wal.js` if you want to switch to WAL mode. This will also enable `synchronous = NORMAL`.
# Setup # Setup
If you get stuck, you're welcome to message @cadence:cadence.moe to ask for help setting up OOYE! If you get stuck, you're welcome to message [#out-of-your-element:cadence.moe](https://matrix.to/#/#out-of-your-element:cadence.moe) or [@cadence:cadence.moe](https://matrix.to/#/@cadence:cadence.moe) to ask for help setting up OOYE!
You'll need: You'll need: