Package discord4j.common.store.impl
Class LocalStoreLayout
- java.lang.Object
-
- discord4j.common.store.impl.LocalStoreLayout
-
- All Implemented Interfaces:
DataAccessor,GatewayDataUpdater,StoreLayout
public class LocalStoreLayout extends Object implements StoreLayout, DataAccessor, GatewayDataUpdater
AStoreLayoutthat stores entities in the heap of the local JVM. This implementation is entirely thread-safe: atomicity guarantees are made so that the cache won't be set in an inconsistent state if two events are received concurrently. However, it is still up to the user to ensure that events are received in the right order.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<Long>countChannels()Counts the number of channels present in the store.Mono<Long>countChannelsInGuild(long guildId)Counts the number of channels present in the store for the given guild ID.Mono<Long>countEmojis()Counts the number of emojis present in the store.Mono<Long>countEmojisInGuild(long guildId)Counts the number of emojis present in the store for the given guild ID.Mono<Long>countExactMembersInGuild(long guildId)Counts the exact number of members for the given guild ID.Mono<Long>countGuilds()Counts the number of guilds present in the store.Mono<Long>countMembers()Counts the number of members present in the store.Mono<Long>countMembersInGuild(long guildId)Counts the number of members present in the store for the given guild ID.Mono<Long>countMessages()Counts the number of messages present in the store.Mono<Long>countMessagesInChannel(long channelId)Counts the number of messages present in the store for the given channel ID.Mono<Long>countPresences()Counts the number of presences present in the store.Mono<Long>countPresencesInGuild(long guildId)Counts the number of presences present in the store for the given guild ID.Mono<Long>countRoles()Counts the number of roles present in the store.Mono<Long>countRolesInGuild(long guildId)Counts the number of roles present in the store for the given guild ID.Mono<Long>countUsers()Counts the number of users present in the store.Mono<Long>countVoiceStates()Counts the number of voice states present in the store.Mono<Long>countVoiceStatesInChannel(long guildId, long channelId)Counts the number of voice states present in the store for the given channel ID.Mono<Long>countVoiceStatesInGuild(long guildId)Counts the number of voice states present in the store for the given guild ID.static LocalStoreLayoutcreate()static LocalStoreLayoutcreate(StorageConfig config)Mono<discord4j.discordjson.json.ChannelData>getChannelById(long channelId)Retrieves data for the channel corresponding to the given channel ID.Flux<discord4j.discordjson.json.ChannelData>getChannels()Retrieves data for all channels present in the store.Flux<discord4j.discordjson.json.ChannelData>getChannelsInGuild(long guildId)Retrieves data for all channels present in the store for the given guild ID.DataAccessorgetDataAccessor()Returns aDataAccessorthat defines action handlers for reading data from the store.Mono<discord4j.discordjson.json.EmojiData>getEmojiById(long guildId, long emojiId)Retrieves data for the emoji corresponding to the given guild ID and emoji ID.Flux<discord4j.discordjson.json.EmojiData>getEmojis()Retrieves data for all emojis present in the store.Flux<discord4j.discordjson.json.EmojiData>getEmojisInGuild(long guildId)Retrieves data for all emojis present in the store for the given guild ID.Flux<discord4j.discordjson.json.MemberData>getExactMembersInGuild(long guildId)Retrieves data for all members for the given guild ID.GatewayDataUpdatergetGatewayDataUpdater()Returns aGatewayDataUpdaterthat defines action handlers for updates received from the Discord gateway.Mono<discord4j.discordjson.json.GuildData>getGuildById(long guildId)Retrieves data for the guild corresponding to the given guild ID.Flux<discord4j.discordjson.json.GuildData>getGuilds()Retrieves data for all guilds present in the store.Mono<discord4j.discordjson.json.MemberData>getMemberById(long guildId, long userId)Retrieves data for the member corresponding to the given guild ID and user ID.Flux<discord4j.discordjson.json.MemberData>getMembers()Retrieves data for all members present in the store.Flux<discord4j.discordjson.json.MemberData>getMembersInGuild(long guildId)Retrieves data for all members present in the store for the given guild ID.Mono<discord4j.discordjson.json.MessageData>getMessageById(long channelId, long messageId)Retrieves data for the message corresponding to the given channel ID and message ID.Flux<discord4j.discordjson.json.MessageData>getMessages()Retrieves data for all messages present in the store.Flux<discord4j.discordjson.json.MessageData>getMessagesInChannel(long channelId)Retrieves data for all messages present in the store for the given channel ID.Mono<discord4j.discordjson.json.PresenceData>getPresenceById(long guildId, long userId)Retrieves data for the presence corresponding to the given guild ID and user ID.Flux<discord4j.discordjson.json.PresenceData>getPresences()Retrieves data for all presences present in the store.Flux<discord4j.discordjson.json.PresenceData>getPresencesInGuild(long guildId)Retrieves data for all presences present in the store for the given guild ID.Mono<discord4j.discordjson.json.RoleData>getRoleById(long guildId, long roleId)Retrieves data for the role corresponding to the given guild ID and role ID.Flux<discord4j.discordjson.json.RoleData>getRoles()Retrieves data for all roles present in the store.Flux<discord4j.discordjson.json.RoleData>getRolesInGuild(long guildId)Retrieves data for all roles present in the store for the given guild ID.Mono<discord4j.discordjson.json.UserData>getUserById(long userId)Retrieves data for the user corresponding to the given user ID.Flux<discord4j.discordjson.json.UserData>getUsers()Retrieves data for all users present in the store.Mono<discord4j.discordjson.json.VoiceStateData>getVoiceStateById(long guildId, long userId)Retrieves data for the voice state corresponding to the given guild ID and user ID.Flux<discord4j.discordjson.json.VoiceStateData>getVoiceStates()Retrieves data for all voice states present in the store.Flux<discord4j.discordjson.json.VoiceStateData>getVoiceStatesInChannel(long guildId, long channelId)Retrieves data for all voice states present in the store for the given guild ID and channel ID.Flux<discord4j.discordjson.json.VoiceStateData>getVoiceStatesInGuild(long guildId)Retrieves data for all voice states present in the store for the given guild ID.Mono<Void>onChannelCreate(int shardIndex, discord4j.discordjson.json.gateway.ChannelCreate dispatch)Updates the internal state of the store according to the givenChannelCreategateway dispatch.Mono<discord4j.discordjson.json.ChannelData>onChannelDelete(int shardIndex, discord4j.discordjson.json.gateway.ChannelDelete dispatch)Updates the internal state of the store according to the givenChannelDeletegateway dispatch.Mono<discord4j.discordjson.json.ChannelData>onChannelUpdate(int shardIndex, discord4j.discordjson.json.gateway.ChannelUpdate dispatch)Updates the internal state of the store according to the givenChannelUpdategateway dispatch.Mono<Void>onGuildCreate(int shardIndex, discord4j.discordjson.json.gateway.GuildCreate dispatch)Updates the internal state of the store according to the givenGuildCreategateway dispatch.Mono<discord4j.discordjson.json.GuildData>onGuildDelete(int shardIndex, discord4j.discordjson.json.gateway.GuildDelete dispatch)Updates the internal state of the store according to the givenGuildDeletegateway dispatch.Mono<Set<discord4j.discordjson.json.EmojiData>>onGuildEmojisUpdate(int shardIndex, discord4j.discordjson.json.gateway.GuildEmojisUpdate dispatch)Updates the internal state of the store according to the givenGuildEmojisUpdategateway dispatch.Mono<Void>onGuildMemberAdd(int shardIndex, discord4j.discordjson.json.gateway.GuildMemberAdd dispatch)Updates the internal state of the store according to the givenGuildMemberAddgateway dispatch.Mono<discord4j.discordjson.json.MemberData>onGuildMemberRemove(int shardIndex, discord4j.discordjson.json.gateway.GuildMemberRemove dispatch)Updates the internal state of the store according to the givenGuildMemberRemovegateway dispatch.Mono<Void>onGuildMembersChunk(int shardIndex, discord4j.discordjson.json.gateway.GuildMembersChunk dispatch)Updates the internal state of the store according to the givenGuildMembersChunkgateway dispatch.Mono<Void>onGuildMembersCompletion(long guildId)Invoked to indicate that all members for the specified guild ID were received.Mono<discord4j.discordjson.json.MemberData>onGuildMemberUpdate(int shardIndex, discord4j.discordjson.json.gateway.GuildMemberUpdate dispatch)Updates the internal state of the store according to the givenGuildMemberUpdategateway dispatch.Mono<Void>onGuildRoleCreate(int shardIndex, discord4j.discordjson.json.gateway.GuildRoleCreate dispatch)Updates the internal state of the store according to the givenGuildRoleCreategateway dispatch.Mono<discord4j.discordjson.json.RoleData>onGuildRoleDelete(int shardIndex, discord4j.discordjson.json.gateway.GuildRoleDelete dispatch)Updates the internal state of the store according to the givenGuildRoleDeletegateway dispatch.Mono<discord4j.discordjson.json.RoleData>onGuildRoleUpdate(int shardIndex, discord4j.discordjson.json.gateway.GuildRoleUpdate dispatch)Updates the internal state of the store according to the givenGuildRoleUpdategateway dispatch.Mono<discord4j.discordjson.json.GuildData>onGuildUpdate(int shardIndex, discord4j.discordjson.json.gateway.GuildUpdate dispatch)Updates the internal state of the store according to the givenGuildUpdategateway dispatch.Mono<Void>onMessageCreate(int shardIndex, discord4j.discordjson.json.gateway.MessageCreate dispatch)Updates the internal state of the store according to the givenMessageCreategateway dispatch.Mono<discord4j.discordjson.json.MessageData>onMessageDelete(int shardIndex, discord4j.discordjson.json.gateway.MessageDelete dispatch)Updates the internal state of the store according to the givenMessageDeletegateway dispatch.Mono<Set<discord4j.discordjson.json.MessageData>>onMessageDeleteBulk(int shardIndex, discord4j.discordjson.json.gateway.MessageDeleteBulk dispatch)Updates the internal state of the store according to the givenMessageDeleteBulkgateway dispatch.Mono<Void>onMessageReactionAdd(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionAdd dispatch)Updates the internal state of the store according to the givenMessageReactionAddgateway dispatch.Mono<Void>onMessageReactionRemove(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionRemove dispatch)Updates the internal state of the store according to the givenMessageReactionRemovegateway dispatch.Mono<Void>onMessageReactionRemoveAll(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionRemoveAll dispatch)Updates the internal state of the store according to the givenMessageReactionRemoveAllgateway dispatch.Mono<Void>onMessageReactionRemoveEmoji(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionRemoveEmoji dispatch)Updates the internal state of the store according to the givenMessageReactionRemoveEmojigateway dispatch.Mono<discord4j.discordjson.json.MessageData>onMessageUpdate(int shardIndex, discord4j.discordjson.json.gateway.MessageUpdate dispatch)Updates the internal state of the store according to the givenMessageUpdategateway dispatch.Mono<PresenceAndUserData>onPresenceUpdate(int shardIndex, discord4j.discordjson.json.gateway.PresenceUpdate dispatch)Updates the internal state of the store according to the givenPresenceUpdategateway dispatch.Mono<Void>onReady(discord4j.discordjson.json.gateway.Ready dispatch)Updates the internal state of the store according to the givenReadygateway dispatch.Mono<Void>onShardInvalidation(int shardIndex, InvalidationCause cause)Handles the invalidation of a specific shard.Mono<discord4j.discordjson.json.UserData>onUserUpdate(int shardIndex, discord4j.discordjson.json.gateway.UserUpdate dispatch)Updates the internal state of the store according to the givenUserUpdategateway dispatch.Mono<discord4j.discordjson.json.VoiceStateData>onVoiceStateUpdateDispatch(int shardIndex, discord4j.discordjson.json.gateway.VoiceStateUpdateDispatch dispatch)Updates the internal state of the store according to the givenVoiceStateUpdateDispatchgateway dispatch.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface discord4j.common.store.api.layout.StoreLayout
getCustomActionMapper
-
-
-
-
Method Detail
-
create
public static LocalStoreLayout create(StorageConfig config)
-
create
public static LocalStoreLayout create()
-
countChannels
public Mono<Long> countChannels()
Description copied from interface:DataAccessorCounts the number of channels present in the store.- Specified by:
countChannelsin interfaceDataAccessor- Returns:
- A
Monoemitting the channel count
-
countChannelsInGuild
public Mono<Long> countChannelsInGuild(long guildId)
Description copied from interface:DataAccessorCounts the number of channels present in the store for the given guild ID.- Specified by:
countChannelsInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Monoemitting the channel count
-
countEmojis
public Mono<Long> countEmojis()
Description copied from interface:DataAccessorCounts the number of emojis present in the store.- Specified by:
countEmojisin interfaceDataAccessor- Returns:
- A
Monoemitting the emoji count
-
countEmojisInGuild
public Mono<Long> countEmojisInGuild(long guildId)
Description copied from interface:DataAccessorCounts the number of emojis present in the store for the given guild ID.- Specified by:
countEmojisInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Monoemitting the emoji count
-
countGuilds
public Mono<Long> countGuilds()
Description copied from interface:DataAccessorCounts the number of guilds present in the store.- Specified by:
countGuildsin interfaceDataAccessor- Returns:
- A
Monoemitting the guild count
-
countMembers
public Mono<Long> countMembers()
Description copied from interface:DataAccessorCounts the number of members present in the store.- Specified by:
countMembersin interfaceDataAccessor- Returns:
- A
Monoemitting the member count
-
countMembersInGuild
public Mono<Long> countMembersInGuild(long guildId)
Description copied from interface:DataAccessorCounts the number of members present in the store for the given guild ID.- Specified by:
countMembersInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Monoemitting the member count
-
countExactMembersInGuild
public Mono<Long> countExactMembersInGuild(long guildId)
Description copied from interface:DataAccessorCounts the exact number of members for the given guild ID. If some members are not present in the store and thus is not able to return an accurate count, it will error withExactResultNotAvailableException.- Specified by:
countExactMembersInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Monoemitting the member count
-
countMessages
public Mono<Long> countMessages()
Description copied from interface:DataAccessorCounts the number of messages present in the store.- Specified by:
countMessagesin interfaceDataAccessor- Returns:
- A
Monoemitting the message count
-
countMessagesInChannel
public Mono<Long> countMessagesInChannel(long channelId)
Description copied from interface:DataAccessorCounts the number of messages present in the store for the given channel ID.- Specified by:
countMessagesInChannelin interfaceDataAccessor- Parameters:
channelId- the channel ID- Returns:
- A
Monoemitting the message count
-
countPresences
public Mono<Long> countPresences()
Description copied from interface:DataAccessorCounts the number of presences present in the store.- Specified by:
countPresencesin interfaceDataAccessor- Returns:
- A
Monoemitting the presence count
-
countPresencesInGuild
public Mono<Long> countPresencesInGuild(long guildId)
Description copied from interface:DataAccessorCounts the number of presences present in the store for the given guild ID.- Specified by:
countPresencesInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Monoemitting the presence count
-
countRoles
public Mono<Long> countRoles()
Description copied from interface:DataAccessorCounts the number of roles present in the store.- Specified by:
countRolesin interfaceDataAccessor- Returns:
- A
Monoemitting the role count
-
countRolesInGuild
public Mono<Long> countRolesInGuild(long guildId)
Description copied from interface:DataAccessorCounts the number of roles present in the store for the given guild ID.- Specified by:
countRolesInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Monoemitting the role count
-
countUsers
public Mono<Long> countUsers()
Description copied from interface:DataAccessorCounts the number of users present in the store.- Specified by:
countUsersin interfaceDataAccessor- Returns:
- A
Monoemitting the user count
-
countVoiceStates
public Mono<Long> countVoiceStates()
Description copied from interface:DataAccessorCounts the number of voice states present in the store.- Specified by:
countVoiceStatesin interfaceDataAccessor- Returns:
- A
Monoemitting the voice state count
-
countVoiceStatesInGuild
public Mono<Long> countVoiceStatesInGuild(long guildId)
Description copied from interface:DataAccessorCounts the number of voice states present in the store for the given guild ID.- Specified by:
countVoiceStatesInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Monoemitting the voice state count
-
countVoiceStatesInChannel
public Mono<Long> countVoiceStatesInChannel(long guildId, long channelId)
Description copied from interface:DataAccessorCounts the number of voice states present in the store for the given channel ID.- Specified by:
countVoiceStatesInChannelin interfaceDataAccessor- Parameters:
guildId- the guild IDchannelId- the channel ID- Returns:
- A
Monoemitting the voice state count
-
getChannels
public Flux<discord4j.discordjson.json.ChannelData> getChannels()
Description copied from interface:DataAccessorRetrieves data for all channels present in the store.- Specified by:
getChannelsin interfaceDataAccessor- Returns:
- A
Fluxemitting the channels, or empty if none is present
-
getChannelsInGuild
public Flux<discord4j.discordjson.json.ChannelData> getChannelsInGuild(long guildId)
Description copied from interface:DataAccessorRetrieves data for all channels present in the store for the given guild ID.- Specified by:
getChannelsInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Fluxemitting the channels, or empty if none is present
-
getChannelById
public Mono<discord4j.discordjson.json.ChannelData> getChannelById(long channelId)
Description copied from interface:DataAccessorRetrieves data for the channel corresponding to the given channel ID.- Specified by:
getChannelByIdin interfaceDataAccessor- Parameters:
channelId- the channel ID- Returns:
- A
Monoemitting the channel, or empty if not found
-
getEmojis
public Flux<discord4j.discordjson.json.EmojiData> getEmojis()
Description copied from interface:DataAccessorRetrieves data for all emojis present in the store.- Specified by:
getEmojisin interfaceDataAccessor- Returns:
- A
Fluxemitting the emojis, or empty if none is present
-
getEmojisInGuild
public Flux<discord4j.discordjson.json.EmojiData> getEmojisInGuild(long guildId)
Description copied from interface:DataAccessorRetrieves data for all emojis present in the store for the given guild ID.- Specified by:
getEmojisInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Fluxemitting the emojis, or empty if none is present
-
getEmojiById
public Mono<discord4j.discordjson.json.EmojiData> getEmojiById(long guildId, long emojiId)
Description copied from interface:DataAccessorRetrieves data for the emoji corresponding to the given guild ID and emoji ID.- Specified by:
getEmojiByIdin interfaceDataAccessor- Parameters:
guildId- the guild IDemojiId- the emoji ID- Returns:
- A
Monoemitting the emoji, or empty if not found
-
getGuilds
public Flux<discord4j.discordjson.json.GuildData> getGuilds()
Description copied from interface:DataAccessorRetrieves data for all guilds present in the store.- Specified by:
getGuildsin interfaceDataAccessor- Returns:
- A
Fluxemitting the guilds, or empty if none is present
-
getGuildById
public Mono<discord4j.discordjson.json.GuildData> getGuildById(long guildId)
Description copied from interface:DataAccessorRetrieves data for the guild corresponding to the given guild ID.- Specified by:
getGuildByIdin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Monoemitting the guild, or empty if not found
-
getMembers
public Flux<discord4j.discordjson.json.MemberData> getMembers()
Description copied from interface:DataAccessorRetrieves data for all members present in the store.- Specified by:
getMembersin interfaceDataAccessor- Returns:
- A
Fluxemitting the members, or empty if none is present
-
getMembersInGuild
public Flux<discord4j.discordjson.json.MemberData> getMembersInGuild(long guildId)
Description copied from interface:DataAccessorRetrieves data for all members present in the store for the given guild ID.- Specified by:
getMembersInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Fluxemitting the members, or empty if none is present
-
getExactMembersInGuild
public Flux<discord4j.discordjson.json.MemberData> getExactMembersInGuild(long guildId)
Description copied from interface:DataAccessorRetrieves data for all members for the given guild ID. If some members are not present in the store and thus is not able to return the full member list of the guild, it will error withExactResultNotAvailableException.- Specified by:
getExactMembersInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Fluxemitting the members, orExactResultNotAvailableExceptionif not all are present
-
getMemberById
public Mono<discord4j.discordjson.json.MemberData> getMemberById(long guildId, long userId)
Description copied from interface:DataAccessorRetrieves data for the member corresponding to the given guild ID and user ID.- Specified by:
getMemberByIdin interfaceDataAccessor- Parameters:
guildId- the guild IDuserId- the user ID- Returns:
- A
Monoemitting the member, or empty if not found
-
getMessages
public Flux<discord4j.discordjson.json.MessageData> getMessages()
Description copied from interface:DataAccessorRetrieves data for all messages present in the store.- Specified by:
getMessagesin interfaceDataAccessor- Returns:
- A
Fluxemitting the messages, or empty if none is present
-
getMessagesInChannel
public Flux<discord4j.discordjson.json.MessageData> getMessagesInChannel(long channelId)
Description copied from interface:DataAccessorRetrieves data for all messages present in the store for the given channel ID.- Specified by:
getMessagesInChannelin interfaceDataAccessor- Parameters:
channelId- the channel ID- Returns:
- A
Fluxemitting the messages, or empty if none is present
-
getMessageById
public Mono<discord4j.discordjson.json.MessageData> getMessageById(long channelId, long messageId)
Description copied from interface:DataAccessorRetrieves data for the message corresponding to the given channel ID and message ID.- Specified by:
getMessageByIdin interfaceDataAccessor- Parameters:
channelId- the channel IDmessageId- the message ID- Returns:
- A
Monoemitting the message, or empty if not found
-
getPresences
public Flux<discord4j.discordjson.json.PresenceData> getPresences()
Description copied from interface:DataAccessorRetrieves data for all presences present in the store.- Specified by:
getPresencesin interfaceDataAccessor- Returns:
- A
Fluxemitting the presences, or empty if none is present
-
getPresencesInGuild
public Flux<discord4j.discordjson.json.PresenceData> getPresencesInGuild(long guildId)
Description copied from interface:DataAccessorRetrieves data for all presences present in the store for the given guild ID.- Specified by:
getPresencesInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Fluxemitting the presences, or empty if none is present
-
getPresenceById
public Mono<discord4j.discordjson.json.PresenceData> getPresenceById(long guildId, long userId)
Description copied from interface:DataAccessorRetrieves data for the presence corresponding to the given guild ID and user ID.- Specified by:
getPresenceByIdin interfaceDataAccessor- Parameters:
guildId- the guild IDuserId- the user ID- Returns:
- A
Monoemitting the presence, or empty if not found
-
getRoles
public Flux<discord4j.discordjson.json.RoleData> getRoles()
Description copied from interface:DataAccessorRetrieves data for all roles present in the store.- Specified by:
getRolesin interfaceDataAccessor- Returns:
- A
Fluxemitting the roles, or empty if none is present
-
getRolesInGuild
public Flux<discord4j.discordjson.json.RoleData> getRolesInGuild(long guildId)
Description copied from interface:DataAccessorRetrieves data for all roles present in the store for the given guild ID.- Specified by:
getRolesInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Fluxemitting the roles, or empty if none is present
-
getRoleById
public Mono<discord4j.discordjson.json.RoleData> getRoleById(long guildId, long roleId)
Description copied from interface:DataAccessorRetrieves data for the role corresponding to the given guild ID and role ID.- Specified by:
getRoleByIdin interfaceDataAccessor- Parameters:
guildId- the guild IDroleId- the role ID- Returns:
- A
Monoemitting the role, or empty if not found
-
getUsers
public Flux<discord4j.discordjson.json.UserData> getUsers()
Description copied from interface:DataAccessorRetrieves data for all users present in the store.- Specified by:
getUsersin interfaceDataAccessor- Returns:
- A
Fluxemitting the users, or empty if none is present
-
getUserById
public Mono<discord4j.discordjson.json.UserData> getUserById(long userId)
Description copied from interface:DataAccessorRetrieves data for the user corresponding to the given user ID.- Specified by:
getUserByIdin interfaceDataAccessor- Parameters:
userId- the user ID- Returns:
- A
Monoemitting the user, or empty if not found
-
getVoiceStates
public Flux<discord4j.discordjson.json.VoiceStateData> getVoiceStates()
Description copied from interface:DataAccessorRetrieves data for all voice states present in the store.- Specified by:
getVoiceStatesin interfaceDataAccessor- Returns:
- A
Fluxemitting the voice states, or empty if none is present
-
getVoiceStatesInChannel
public Flux<discord4j.discordjson.json.VoiceStateData> getVoiceStatesInChannel(long guildId, long channelId)
Description copied from interface:DataAccessorRetrieves data for all voice states present in the store for the given guild ID and channel ID.- Specified by:
getVoiceStatesInChannelin interfaceDataAccessor- Parameters:
guildId- the guild IDchannelId- the channel ID- Returns:
- A
Fluxemitting the voice states, or empty if none is present
-
getVoiceStatesInGuild
public Flux<discord4j.discordjson.json.VoiceStateData> getVoiceStatesInGuild(long guildId)
Description copied from interface:DataAccessorRetrieves data for all voice states present in the store for the given guild ID.- Specified by:
getVoiceStatesInGuildin interfaceDataAccessor- Parameters:
guildId- the guild ID- Returns:
- A
Fluxemitting the voice states, or empty if none is present
-
getVoiceStateById
public Mono<discord4j.discordjson.json.VoiceStateData> getVoiceStateById(long guildId, long userId)
Description copied from interface:DataAccessorRetrieves data for the voice state corresponding to the given guild ID and user ID.- Specified by:
getVoiceStateByIdin interfaceDataAccessor- Parameters:
guildId- the guild IDuserId- the user ID- Returns:
- A
Monoemitting the voice state, or empty if not found
-
onChannelCreate
public Mono<Void> onChannelCreate(int shardIndex, discord4j.discordjson.json.gateway.ChannelCreate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenChannelCreategateway dispatch. This will typically perform an insert operation on the relatedChannelData, and add the ID to the list returned byGuildData.channels()if applicable.- Specified by:
onChannelCreatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onChannelDelete
public Mono<discord4j.discordjson.json.ChannelData> onChannelDelete(int shardIndex, discord4j.discordjson.json.gateway.ChannelDelete dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenChannelDeletegateway dispatch. This will typically perform a delete operation on a relatedChannelDatathat is already present in the store, and remove the ID from the list returned byGuildData.channels()if applicable.- Specified by:
onChannelDeletein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theChannelDatabefore the deletion
-
onChannelUpdate
public Mono<discord4j.discordjson.json.ChannelData> onChannelUpdate(int shardIndex, discord4j.discordjson.json.gateway.ChannelUpdate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenChannelUpdategateway dispatch. This will typically perform an update operation on a relatedChannelDatathat is already present in the store.- Specified by:
onChannelUpdatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theChannelDatabefore the update
-
onGuildCreate
public Mono<Void> onGuildCreate(int shardIndex, discord4j.discordjson.json.gateway.GuildCreate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildCreategateway dispatch. This will typically perform an insert operation on the relatedGuildData, as well as all associated entities received in the payload, such as channels, roles, emojis, members, voice states and presences.- Specified by:
onGuildCreatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onGuildDelete
public Mono<discord4j.discordjson.json.GuildData> onGuildDelete(int shardIndex, discord4j.discordjson.json.gateway.GuildDelete dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildDeletegateway dispatch. This will typically perform a delete operation on a relatedGuildDatathat is already present in the store, and clean up all entities that are associated to that guild, such as the channels, the roles, the emojis, the members, the voice states and the messages.- Specified by:
onGuildDeletein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theGuildDatabefore the deletion
-
onGuildEmojisUpdate
public Mono<Set<discord4j.discordjson.json.EmojiData>> onGuildEmojisUpdate(int shardIndex, discord4j.discordjson.json.gateway.GuildEmojisUpdate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildEmojisUpdategateway dispatch. This will typically perform an update operation on a related collection ofEmojiDatathat is already present in the store, and update the list returned byGuildData.emojis().- Specified by:
onGuildEmojisUpdatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of the set ofEmojiDatabefore the update
-
onGuildMemberAdd
public Mono<Void> onGuildMemberAdd(int shardIndex, discord4j.discordjson.json.gateway.GuildMemberAdd dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildMemberAddgateway dispatch. This will typically perform an insert operation on the relatedMemberData, add the ID of the member into the list returned byGuildData.members(), and increment the count returned byGuildCreateFields.memberCount().- Specified by:
onGuildMemberAddin interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onGuildMemberRemove
public Mono<discord4j.discordjson.json.MemberData> onGuildMemberRemove(int shardIndex, discord4j.discordjson.json.gateway.GuildMemberRemove dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildMemberRemovegateway dispatch. This will typically perform a delete operation on the relatedMemberData, remove the ID of the member from the list returned byGuildData.members(), and decrement the count returned byGuildCreateFields.memberCount().- Specified by:
onGuildMemberRemovein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theMemberDatabefore the deletion
-
onGuildMembersChunk
public Mono<Void> onGuildMembersChunk(int shardIndex, discord4j.discordjson.json.gateway.GuildMembersChunk dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildMembersChunkgateway dispatch. This will typically perform the same kind of operations thanGatewayDataUpdater.onGuildMemberAdd(int, GuildMemberAdd), but adapted for whole chunks of members.- Specified by:
onGuildMembersChunkin interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onGuildMemberUpdate
public Mono<discord4j.discordjson.json.MemberData> onGuildMemberUpdate(int shardIndex, discord4j.discordjson.json.gateway.GuildMemberUpdate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildMemberUpdategateway dispatch. This will typically perform an update operation on a relatedMemberDatathat is already present in the store.- Specified by:
onGuildMemberUpdatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theMemberDatabefore the update
-
onGuildRoleCreate
public Mono<Void> onGuildRoleCreate(int shardIndex, discord4j.discordjson.json.gateway.GuildRoleCreate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildRoleCreategateway dispatch. This will typically perform an insert operation on the relatedRoleData, and add the role ID to the list returned byGuildData.roles().- Specified by:
onGuildRoleCreatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onGuildRoleDelete
public Mono<discord4j.discordjson.json.RoleData> onGuildRoleDelete(int shardIndex, discord4j.discordjson.json.gateway.GuildRoleDelete dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildRoleDeletegateway dispatch. This will typically perform a delete operation on a relatedRoleDatathat is already present in the store, and remove the role ID from the list returned byGuildData.roles()andPartialMemberData.roles().- Specified by:
onGuildRoleDeletein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theRoleDatabefore the deletion
-
onGuildRoleUpdate
public Mono<discord4j.discordjson.json.RoleData> onGuildRoleUpdate(int shardIndex, discord4j.discordjson.json.gateway.GuildRoleUpdate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildRoleUpdategateway dispatch. This will typically perform an update operation on a relatedRoleDatathat is already present in the store.- Specified by:
onGuildRoleUpdatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theRoleDatabefore the update
-
onGuildUpdate
public Mono<discord4j.discordjson.json.GuildData> onGuildUpdate(int shardIndex, discord4j.discordjson.json.gateway.GuildUpdate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenGuildUpdategateway dispatch. This will typically perform an update operation on a relatedGuildDatathat is already present in the store.- Specified by:
onGuildUpdatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theGuildDatabefore the update
-
onShardInvalidation
public Mono<Void> onShardInvalidation(int shardIndex, InvalidationCause cause)
Description copied from interface:GatewayDataUpdaterHandles the invalidation of a specific shard. When a shard is invalidated, all cached data related to it should be considered stale and the implementation may perform some cleanup work.- Specified by:
onShardInvalidationin interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard to invalidatecause- the cause of the invalidation- Returns:
- a
Monocompleting when the operation is done
-
onMessageCreate
public Mono<Void> onMessageCreate(int shardIndex, discord4j.discordjson.json.gateway.MessageCreate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenMessageCreategateway dispatch. This will typically perform an insert operation on the relatedMessageData, and update thelast_message_idfield of the channel where the message was sent in.- Specified by:
onMessageCreatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onMessageDelete
public Mono<discord4j.discordjson.json.MessageData> onMessageDelete(int shardIndex, discord4j.discordjson.json.gateway.MessageDelete dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenMessageDeletegateway dispatch. This will typically perform a delete operation on a relatedMessageDatathat is already present in the store.- Specified by:
onMessageDeletein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theMessageDatabefore the deletion
-
onMessageDeleteBulk
public Mono<Set<discord4j.discordjson.json.MessageData>> onMessageDeleteBulk(int shardIndex, discord4j.discordjson.json.gateway.MessageDeleteBulk dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenMessageDeleteBulkgateway dispatch. This will typically perform a delete operation on a related collection ofMessageDatathat is already present in the store.- Specified by:
onMessageDeleteBulkin interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of the set ofMessageDatabefore the deletion
-
onMessageReactionAdd
public Mono<Void> onMessageReactionAdd(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionAdd dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenMessageReactionAddgateway dispatch. This will typically perform an update operation on a relatedMessageDatathat is already present in the store in order to add the reaction.- Specified by:
onMessageReactionAddin interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onMessageReactionRemove
public Mono<Void> onMessageReactionRemove(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionRemove dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenMessageReactionRemovegateway dispatch. This will typically perform an update operation on a relatedMessageDatathat is already present in the store in order to remove the reaction.- Specified by:
onMessageReactionRemovein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onMessageReactionRemoveAll
public Mono<Void> onMessageReactionRemoveAll(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionRemoveAll dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenMessageReactionRemoveAllgateway dispatch. This will typically perform an update operation on a relatedMessageDatathat is already present in the store in order to remove all reactions.- Specified by:
onMessageReactionRemoveAllin interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onMessageReactionRemoveEmoji
public Mono<Void> onMessageReactionRemoveEmoji(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionRemoveEmoji dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenMessageReactionRemoveEmojigateway dispatch. This will typically perform an update operation on a relatedMessageDatathat is already present in the store in order to remove all reactions for a specific emoji.- Specified by:
onMessageReactionRemoveEmojiin interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onMessageUpdate
public Mono<discord4j.discordjson.json.MessageData> onMessageUpdate(int shardIndex, discord4j.discordjson.json.gateway.MessageUpdate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenMessageUpdategateway dispatch. This will typically perform an update operation on a relatedMessageDatathat is already present in the store.- Specified by:
onMessageUpdatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theMessageDatabefore the update
-
onPresenceUpdate
public Mono<PresenceAndUserData> onPresenceUpdate(int shardIndex, discord4j.discordjson.json.gateway.PresenceUpdate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenPresenceUpdategateway dispatch. This will typically perform an insert or an update operation on the relatedPresenceData, and update the relatedUserDatato reflect the new presence.- Specified by:
onPresenceUpdatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of both thePresenceDataand theUserDatabefore the update
-
onReady
public Mono<Void> onReady(discord4j.discordjson.json.gateway.Ready dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenReadygateway dispatch. This will typically perform an insert operation on theUserDatathat represents the self-user, and allocate the resources needed to receive further events happening on this shard index.- Specified by:
onReadyin interfaceGatewayDataUpdater- Parameters:
dispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done
-
onUserUpdate
public Mono<discord4j.discordjson.json.UserData> onUserUpdate(int shardIndex, discord4j.discordjson.json.gateway.UserUpdate dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenUserUpdategateway dispatch. This will typically perform an update operation on a relatedUserDatathat is already present in the store.- Specified by:
onUserUpdatein interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theUserDatabefore the update
-
onVoiceStateUpdateDispatch
public Mono<discord4j.discordjson.json.VoiceStateData> onVoiceStateUpdateDispatch(int shardIndex, discord4j.discordjson.json.gateway.VoiceStateUpdateDispatch dispatch)
Description copied from interface:GatewayDataUpdaterUpdates the internal state of the store according to the givenVoiceStateUpdateDispatchgateway dispatch. This will typically perform an insert, update or delete operation on the relatedVoiceStateData.- Specified by:
onVoiceStateUpdateDispatchin interfaceGatewayDataUpdater- Parameters:
shardIndex- the index of the shard where the dispatch comes fromdispatch- the dispatch data coming from Discord gateway- Returns:
- a
Monocompleting when the operation is done, optionally returning the old state of theVoiceStateDatabefore the update
-
onGuildMembersCompletion
public Mono<Void> onGuildMembersCompletion(long guildId)
Description copied from interface:GatewayDataUpdaterInvoked to indicate that all members for the specified guild ID were received. It serves as a hint to indicate to the store that information on the full member list for this specific guild may now be accurately returned, so that further calls toDataAccessor.countExactMembersInGuild(long)andDataAccessor.getExactMembersInGuild(long)with the same guild ID no longer fail.- Specified by:
onGuildMembersCompletionin interfaceGatewayDataUpdater- Parameters:
guildId- the guild ID- Returns:
- a
Monocompleting when the operation is done
-
getDataAccessor
public DataAccessor getDataAccessor()
Description copied from interface:StoreLayoutReturns aDataAccessorthat defines action handlers for reading data from the store.- Specified by:
getDataAccessorin interfaceStoreLayout- Returns:
- a
DataAccessor
-
getGatewayDataUpdater
public GatewayDataUpdater getGatewayDataUpdater()
Description copied from interface:StoreLayoutReturns aGatewayDataUpdaterthat defines action handlers for updates received from the Discord gateway.- Specified by:
getGatewayDataUpdaterin interfaceStoreLayout- Returns:
- a
GatewayDataUpdater
-
-