Interface GatewayDataUpdater

  • All Known Implementing Classes:
    LegacyStoreLayout, LocalStoreLayout

    public interface GatewayDataUpdater
    Defines methods to handle update operations in response to events received from the Discord gateway.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Mono<Void> onChannelCreate​(int shardIndex, discord4j.discordjson.json.gateway.ChannelCreate dispatch)
      Updates the internal state of the store according to the given ChannelCreate gateway 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 given ChannelDelete gateway 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 given ChannelUpdate gateway dispatch.
      Mono<Void> onGuildCreate​(int shardIndex, discord4j.discordjson.json.gateway.GuildCreate dispatch)
      Updates the internal state of the store according to the given GuildCreate gateway 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 given GuildDelete gateway 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 given GuildEmojisUpdate gateway dispatch.
      Mono<Void> onGuildMemberAdd​(int shardIndex, discord4j.discordjson.json.gateway.GuildMemberAdd dispatch)
      Updates the internal state of the store according to the given GuildMemberAdd gateway 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 given GuildMemberRemove gateway dispatch.
      Mono<Void> onGuildMembersChunk​(int shardIndex, discord4j.discordjson.json.gateway.GuildMembersChunk dispatch)
      Updates the internal state of the store according to the given GuildMembersChunk gateway 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 given GuildMemberUpdate gateway dispatch.
      Mono<Void> onGuildRoleCreate​(int shardIndex, discord4j.discordjson.json.gateway.GuildRoleCreate dispatch)
      Updates the internal state of the store according to the given GuildRoleCreate gateway 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 given GuildRoleDelete gateway 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 given GuildRoleUpdate gateway 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 given GuildUpdate gateway dispatch.
      Mono<Void> onMessageCreate​(int shardIndex, discord4j.discordjson.json.gateway.MessageCreate dispatch)
      Updates the internal state of the store according to the given MessageCreate gateway 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 given MessageDelete gateway 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 given MessageDeleteBulk gateway dispatch.
      Mono<Void> onMessageReactionAdd​(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionAdd dispatch)
      Updates the internal state of the store according to the given MessageReactionAdd gateway dispatch.
      Mono<Void> onMessageReactionRemove​(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionRemove dispatch)
      Updates the internal state of the store according to the given MessageReactionRemove gateway dispatch.
      Mono<Void> onMessageReactionRemoveAll​(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionRemoveAll dispatch)
      Updates the internal state of the store according to the given MessageReactionRemoveAll gateway dispatch.
      Mono<Void> onMessageReactionRemoveEmoji​(int shardIndex, discord4j.discordjson.json.gateway.MessageReactionRemoveEmoji dispatch)
      Updates the internal state of the store according to the given MessageReactionRemoveEmoji gateway 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 given MessageUpdate gateway dispatch.
      Mono<PresenceAndUserData> onPresenceUpdate​(int shardIndex, discord4j.discordjson.json.gateway.PresenceUpdate dispatch)
      Updates the internal state of the store according to the given PresenceUpdate gateway dispatch.
      Mono<Void> onReady​(discord4j.discordjson.json.gateway.Ready dispatch)
      Updates the internal state of the store according to the given Ready gateway 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 given UserUpdate gateway 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 given VoiceStateUpdateDispatch gateway dispatch.
    • Method Detail

      • onChannelCreate

        Mono<Void> onChannelCreate​(int shardIndex,
                                   discord4j.discordjson.json.gateway.ChannelCreate dispatch)
        Updates the internal state of the store according to the given ChannelCreate gateway dispatch. This will typically perform an insert operation on the related ChannelData, and add the ID to the list returned by GuildData.channels() if applicable.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onChannelDelete

        Mono<discord4j.discordjson.json.ChannelData> onChannelDelete​(int shardIndex,
                                                                     discord4j.discordjson.json.gateway.ChannelDelete dispatch)
        Updates the internal state of the store according to the given ChannelDelete gateway dispatch. This will typically perform a delete operation on a related ChannelData that is already present in the store, and remove the ID from the list returned by GuildData.channels() if applicable.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the ChannelData before the deletion
      • onChannelUpdate

        Mono<discord4j.discordjson.json.ChannelData> onChannelUpdate​(int shardIndex,
                                                                     discord4j.discordjson.json.gateway.ChannelUpdate dispatch)
        Updates the internal state of the store according to the given ChannelUpdate gateway dispatch. This will typically perform an update operation on a related ChannelData that is already present in the store.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the ChannelData before the update
      • onGuildCreate

        Mono<Void> onGuildCreate​(int shardIndex,
                                 discord4j.discordjson.json.gateway.GuildCreate dispatch)
        Updates the internal state of the store according to the given GuildCreate gateway dispatch. This will typically perform an insert operation on the related GuildData, as well as all associated entities received in the payload, such as channels, roles, emojis, members, voice states and presences.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onGuildDelete

        Mono<discord4j.discordjson.json.GuildData> onGuildDelete​(int shardIndex,
                                                                 discord4j.discordjson.json.gateway.GuildDelete dispatch)
        Updates the internal state of the store according to the given GuildDelete gateway dispatch. This will typically perform a delete operation on a related GuildData that 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.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the GuildData before the deletion
      • onGuildEmojisUpdate

        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 given GuildEmojisUpdate gateway dispatch. This will typically perform an update operation on a related collection of EmojiData that is already present in the store, and update the list returned by GuildData.emojis().
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the set of EmojiData before the update
      • onGuildMemberAdd

        Mono<Void> onGuildMemberAdd​(int shardIndex,
                                    discord4j.discordjson.json.gateway.GuildMemberAdd dispatch)
        Updates the internal state of the store according to the given GuildMemberAdd gateway dispatch. This will typically perform an insert operation on the related MemberData, add the ID of the member into the list returned by GuildData.members(), and increment the count returned by GuildCreateFields.memberCount().
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onGuildMemberRemove

        Mono<discord4j.discordjson.json.MemberData> onGuildMemberRemove​(int shardIndex,
                                                                        discord4j.discordjson.json.gateway.GuildMemberRemove dispatch)
        Updates the internal state of the store according to the given GuildMemberRemove gateway dispatch. This will typically perform a delete operation on the related MemberData, remove the ID of the member from the list returned by GuildData.members(), and decrement the count returned by GuildCreateFields.memberCount().
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the MemberData before the deletion
      • onGuildMembersChunk

        Mono<Void> onGuildMembersChunk​(int shardIndex,
                                       discord4j.discordjson.json.gateway.GuildMembersChunk dispatch)
        Updates the internal state of the store according to the given GuildMembersChunk gateway dispatch. This will typically perform the same kind of operations than onGuildMemberAdd(int, GuildMemberAdd), but adapted for whole chunks of members.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onGuildMemberUpdate

        Mono<discord4j.discordjson.json.MemberData> onGuildMemberUpdate​(int shardIndex,
                                                                        discord4j.discordjson.json.gateway.GuildMemberUpdate dispatch)
        Updates the internal state of the store according to the given GuildMemberUpdate gateway dispatch. This will typically perform an update operation on a related MemberData that is already present in the store.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the MemberData before the update
      • onGuildRoleCreate

        Mono<Void> onGuildRoleCreate​(int shardIndex,
                                     discord4j.discordjson.json.gateway.GuildRoleCreate dispatch)
        Updates the internal state of the store according to the given GuildRoleCreate gateway dispatch. This will typically perform an insert operation on the related RoleData, and add the role ID to the list returned by GuildData.roles().
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onGuildRoleDelete

        Mono<discord4j.discordjson.json.RoleData> onGuildRoleDelete​(int shardIndex,
                                                                    discord4j.discordjson.json.gateway.GuildRoleDelete dispatch)
        Updates the internal state of the store according to the given GuildRoleDelete gateway dispatch. This will typically perform a delete operation on a related RoleData that is already present in the store, and remove the role ID from the list returned by GuildData.roles() and PartialMemberData.roles().
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the RoleData before the deletion
      • onGuildRoleUpdate

        Mono<discord4j.discordjson.json.RoleData> onGuildRoleUpdate​(int shardIndex,
                                                                    discord4j.discordjson.json.gateway.GuildRoleUpdate dispatch)
        Updates the internal state of the store according to the given GuildRoleUpdate gateway dispatch. This will typically perform an update operation on a related RoleData that is already present in the store.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the RoleData before the update
      • onGuildUpdate

        Mono<discord4j.discordjson.json.GuildData> onGuildUpdate​(int shardIndex,
                                                                 discord4j.discordjson.json.gateway.GuildUpdate dispatch)
        Updates the internal state of the store according to the given GuildUpdate gateway dispatch. This will typically perform an update operation on a related GuildData that is already present in the store.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the GuildData before the update
      • onShardInvalidation

        Mono<Void> onShardInvalidation​(int shardIndex,
                                       InvalidationCause cause)
        Handles 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.
        Parameters:
        shardIndex - the index of the shard to invalidate
        cause - the cause of the invalidation
        Returns:
        a Mono completing when the operation is done
      • onMessageCreate

        Mono<Void> onMessageCreate​(int shardIndex,
                                   discord4j.discordjson.json.gateway.MessageCreate dispatch)
        Updates the internal state of the store according to the given MessageCreate gateway dispatch. This will typically perform an insert operation on the related MessageData, and update the last_message_id field of the channel where the message was sent in.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onMessageDelete

        Mono<discord4j.discordjson.json.MessageData> onMessageDelete​(int shardIndex,
                                                                     discord4j.discordjson.json.gateway.MessageDelete dispatch)
        Updates the internal state of the store according to the given MessageDelete gateway dispatch. This will typically perform a delete operation on a related MessageData that is already present in the store.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the MessageData before the deletion
      • onMessageDeleteBulk

        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 given MessageDeleteBulk gateway dispatch. This will typically perform a delete operation on a related collection of MessageData that is already present in the store.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the set of MessageData before the deletion
      • onMessageReactionAdd

        Mono<Void> onMessageReactionAdd​(int shardIndex,
                                        discord4j.discordjson.json.gateway.MessageReactionAdd dispatch)
        Updates the internal state of the store according to the given MessageReactionAdd gateway dispatch. This will typically perform an update operation on a related MessageData that is already present in the store in order to add the reaction.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onMessageReactionRemove

        Mono<Void> onMessageReactionRemove​(int shardIndex,
                                           discord4j.discordjson.json.gateway.MessageReactionRemove dispatch)
        Updates the internal state of the store according to the given MessageReactionRemove gateway dispatch. This will typically perform an update operation on a related MessageData that is already present in the store in order to remove the reaction.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onMessageReactionRemoveAll

        Mono<Void> onMessageReactionRemoveAll​(int shardIndex,
                                              discord4j.discordjson.json.gateway.MessageReactionRemoveAll dispatch)
        Updates the internal state of the store according to the given MessageReactionRemoveAll gateway dispatch. This will typically perform an update operation on a related MessageData that is already present in the store in order to remove all reactions.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onMessageReactionRemoveEmoji

        Mono<Void> onMessageReactionRemoveEmoji​(int shardIndex,
                                                discord4j.discordjson.json.gateway.MessageReactionRemoveEmoji dispatch)
        Updates the internal state of the store according to the given MessageReactionRemoveEmoji gateway dispatch. This will typically perform an update operation on a related MessageData that is already present in the store in order to remove all reactions for a specific emoji.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onMessageUpdate

        Mono<discord4j.discordjson.json.MessageData> onMessageUpdate​(int shardIndex,
                                                                     discord4j.discordjson.json.gateway.MessageUpdate dispatch)
        Updates the internal state of the store according to the given MessageUpdate gateway dispatch. This will typically perform an update operation on a related MessageData that is already present in the store.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the MessageData before the update
      • onPresenceUpdate

        Mono<PresenceAndUserData> onPresenceUpdate​(int shardIndex,
                                                   discord4j.discordjson.json.gateway.PresenceUpdate dispatch)
        Updates the internal state of the store according to the given PresenceUpdate gateway dispatch. This will typically perform an insert or an update operation on the related PresenceData, and update the related UserData to reflect the new presence.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of both the PresenceData and the UserData before the update
      • onReady

        Mono<Void> onReady​(discord4j.discordjson.json.gateway.Ready dispatch)
        Updates the internal state of the store according to the given Ready gateway dispatch. This will typically perform an insert operation on the UserData that represents the self-user, and allocate the resources needed to receive further events happening on this shard index.
        Parameters:
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done
      • onUserUpdate

        Mono<discord4j.discordjson.json.UserData> onUserUpdate​(int shardIndex,
                                                               discord4j.discordjson.json.gateway.UserUpdate dispatch)
        Updates the internal state of the store according to the given UserUpdate gateway dispatch. This will typically perform an update operation on a related UserData that is already present in the store.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the UserData before the update
      • onVoiceStateUpdateDispatch

        Mono<discord4j.discordjson.json.VoiceStateData> onVoiceStateUpdateDispatch​(int shardIndex,
                                                                                   discord4j.discordjson.json.gateway.VoiceStateUpdateDispatch dispatch)
        Updates the internal state of the store according to the given VoiceStateUpdateDispatch gateway dispatch. This will typically perform an insert, update or delete operation on the related VoiceStateData.
        Parameters:
        shardIndex - the index of the shard where the dispatch comes from
        dispatch - the dispatch data coming from Discord gateway
        Returns:
        a Mono completing when the operation is done, optionally returning the old state of the VoiceStateData before the update
      • onGuildMembersCompletion

        Mono<Void> onGuildMembersCompletion​(long guildId)
        Invoked 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 to DataAccessor.countExactMembersInGuild(long) and DataAccessor.getExactMembersInGuild(long) with the same guild ID no longer fail.
        Parameters:
        guildId - the guild ID
        Returns:
        a Mono completing when the operation is done