Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTables ¶
func CreateTables(ctx context.Context, client *dynamodb.Client, chatsTable, dmInboxTable, groupMembersTable, userStateTable, activityTable, keyEnvelopesTable, lobbiesTable, featuredGroupsTable, holdingsTable, invitesTable, pinsTable string) error
CreateTables provisions the chats, dm_inbox, group_members, chat_user_state, chat_activity, chat_key_envelopes, chat_lobbies, chat_featured_groups, chat_holdings, chat_invites and chat_pins tables with on-demand billing. The chats table is keyed by pk only; dm_inbox is keyed by (pk, sk) with a GSI ordering each user's DMs by last_activity; group_members is keyed by (pk, sk) = (chat, user) — plus one "#meta" aggregates item per group — with an inverted GSI for listing a user's group chats, a sparse GSI of a group's joined members by join time (paging a large roster newest-first; see gsiByJoinedAt), and TTL on expires_at sweeping departed members' tombstones (see tombstoneTTL); chat_user_state is keyed by (pk, sk) = (user, chat) — plus one "#meta" aggregates item per chat — with a sparse GSI of a chat's recorded mutes by when they end (see gsiByMuted), an inverted GSI of a chat's records by user (see gsiUserStateByUser) and a sparse GSI of a chat's restricted users by when they were restricted (see gsiRestricted); chat_activity is keyed by (pk, sk) = (chat, user) with two LSIs, one by last_sent_at (lsiByLastSentAt) and one by activity_score (lsiByActivityScore), and TTL on expires_at; chat_key_envelopes is keyed by (pk, sk) = (user, chat) with no index; chat_lobbies is keyed by (pk, sk) = (user, chat) — plus one "#meta" aggregates item per chat and per user — with a sparse GSI of a chat's lobby by entry time (see gsiLobbyByChat); chat_featured_groups is keyed by (pk, sk) = (user, position) — plus one "#meta" item per user — with no index; chat_holdings is keyed by pk = chat with a GSI ranking a mint's groups by holdings (see gsiByMintRank) and a GSI of the refresh queue by due time (see refreshQueueIndex); chat_invites is keyed by (pk, sk) = (invite, item) with three sparse GSIs on the invite's record, a chat's invites by creation (gsiInvitesByChat), one creator's invites to a chat by creation (gsiInvitesByChatCreator) and a chat's invites that are neither revoked nor used up by expiry (gsiInvitesActive), and TTL on expires_at, which only an invite's copy of the chat key carries; chat_pins is keyed by (pk, sk) = (chat, message) — plus one "#meta" summary item per chat — with an LSI of a chat's pins in pin order (see lsiByPinned), which, being an LSI, exists only if the table was created with it. It is idempotent and blocks until all tables are ACTIVE. It creates missing tables only: a table that exists is left as it is, and so is never given an index added to its definition here since it was created — gsiRestricted on a live chat_user_state is added out of band (see the store's doc).
func NewInDynamoDB ¶
func NewInDynamoDB(client *dynamodb.Client, chatsTable, dmInboxTable, groupMembersTable, userStateTable, activityTable, keyEnvelopesTable, lobbiesTable, featuredGroupsTable, holdingsTable, invitesTable, pinsTable string, excludedFromFeed []*commonpb.UserId) chat.Store
NewInDynamoDB returns a chat.Store backed by the given DynamoDB tables, creating every DM with a user in excludedFromFeed excluding them from the feed (see chat.FeedExclusions); nil excludes no one. Use CreateTables to provision the tables.
Types ¶
This section is empty.