You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mtcute gives byte fields (fileReference, a photo's stripped thumbnail and others) as Uint8Array, and JSON.stringify writes each one as an object with a key per byte. A made-up photo message's raw_json was about 7.7 KB for that reason; base64 took one from 7,141 to 1,330 bytes (#79). raw_json is written by several paths (history pages, live updates, tg send, chats and users), each with its own JSON.stringify.
Proposed:
One serializer for every raw_json write: bigint as a string (as most paths do today) and Uint8Array as a base64 string.
New and re-fetched rows use it. Rows already cached stay as they are until a background re-encode exists (see the follow-up on background migrations).
The stripped thumbnail stays in raw_json: once a message is deleted on Telegram, it is the only trace of the picture.
docs/database-schema.md says how byte fields are stored, so tg sql users can read them with json_extract.
Done when every raw_json write goes through the serializer, a test checks a made-up photo message's size and its base64 fields, and the docs and changelog describe it. Related: #80.
Activity
feat(cache): store byte arrays in raw_json as base64