Documentation ¶
Index ¶
- type InMemoryTracker
- func (tracker *InMemoryTracker) DelShard(shardID int64)
- func (tracker *InMemoryTracker) GetGuild(guildID int64) *dstate.GuildSet
- func (tracker *InMemoryTracker) GetMember(guildID int64, memberID int64) *dstate.MemberState
- func (tracker *InMemoryTracker) GetMemberPermissions(guildID int64, channelID int64, memberID int64) (perms int64, ok bool)
- func (tracker *InMemoryTracker) GetMessages(guildID int64, channelID int64, query *dstate.MessagesQuery) []*dstate.MessageState
- func (tracker *InMemoryTracker) GetRolePermisisons(guildID int64, channelID int64, memberID int64, roles []int64) (perms int64, ok bool)
- func (tracker *InMemoryTracker) GetShardGuilds(shardID int64) []*dstate.GuildSet
- func (t *InMemoryTracker) HandleEvent(s *discordgo.Session, evt interface{})
- func (tracker *InMemoryTracker) IterateMembers(guildID int64, f func(chunk []*dstate.MemberState) bool)
- func (t *InMemoryTracker) RunGCLoop(interval time.Duration)
- func (tracker *InMemoryTracker) SetGuild(gs *dstate.GuildSet)
- func (tracker *InMemoryTracker) SetMember(ms *dstate.MemberState)
- type ShardTracker
- type SparseGuildState
- type TrackerConfig
- type WrappedMember
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryTracker ¶
type InMemoryTracker struct {
// contains filtered or unexported fields
}
func NewInMemoryTracker ¶
func NewInMemoryTracker(conf TrackerConfig, totalShards int64) *InMemoryTracker
func (*InMemoryTracker) DelShard ¶
func (tracker *InMemoryTracker) DelShard(shardID int64)
DelShard allows you to manually reset shards in the state notice how i said reset and not delete, as the shards themselves are fixed.
func (*InMemoryTracker) GetGuild ¶
func (tracker *InMemoryTracker) GetGuild(guildID int64) *dstate.GuildSet
func (*InMemoryTracker) GetMember ¶
func (tracker *InMemoryTracker) GetMember(guildID int64, memberID int64) *dstate.MemberState
func (*InMemoryTracker) GetMemberPermissions ¶
func (*InMemoryTracker) GetMessages ¶
func (tracker *InMemoryTracker) GetMessages(guildID int64, channelID int64, query *dstate.MessagesQuery) []*dstate.MessageState
func (*InMemoryTracker) GetRolePermisisons ¶
func (*InMemoryTracker) GetShardGuilds ¶
func (tracker *InMemoryTracker) GetShardGuilds(shardID int64) []*dstate.GuildSet
func (*InMemoryTracker) HandleEvent ¶
func (t *InMemoryTracker) HandleEvent(s *discordgo.Session, evt interface{})
func (*InMemoryTracker) IterateMembers ¶
func (tracker *InMemoryTracker) IterateMembers(guildID int64, f func(chunk []*dstate.MemberState) bool)
this IterateMembers implementation is very simple, it makes a full copy of the member slice and calls f in one chunk
func (*InMemoryTracker) RunGCLoop ¶
func (t *InMemoryTracker) RunGCLoop(interval time.Duration)
RunGCLoop starts a goroutine per shard that runs a gc on a guild per interval note that this is per shard, so if you have the interval set to 1s and 10 shards, there will effectively be 10 guilds per second gc'd
func (*InMemoryTracker) SetGuild ¶
func (tracker *InMemoryTracker) SetGuild(gs *dstate.GuildSet)
SetGuild allows you to manually add guilds to the state tracker, for example when recovering state
func (*InMemoryTracker) SetMember ¶
func (tracker *InMemoryTracker) SetMember(ms *dstate.MemberState)
SetMember allows you to manually add members to the state tracker, for example for caching reasons
type ShardTracker ¶
type ShardTracker struct {
// contains filtered or unexported fields
}
func (*ShardTracker) HandleEvent ¶
func (tracker *ShardTracker) HandleEvent(s *discordgo.Session, i interface{})
type SparseGuildState ¶
type SparseGuildState struct { Guild *dstate.GuildState Channels []dstate.ChannelState Threads []dstate.ChannelState Roles []discordgo.Role Emojis []discordgo.Emoji VoiceStates []discordgo.VoiceState }
These are updated less frequently and so we remake the indiv lists on update this makes us able to just return a straight reference, since the object is effectively immutable TODO: reuse the interface version of this?
func SparseGuildStateFromDstate ¶
func SparseGuildStateFromDstate(gs *dstate.GuildSet) *SparseGuildState
type TrackerConfig ¶
type WrappedMember ¶
type WrappedMember struct { dstate.MemberState // contains filtered or unexported fields }