statefdb

package
v0.0.0-...-7f4bee4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChannelSubspaceName is the enum for the channel subspace.
	ChannelSubspaceName = iota
	// GuildSubspaceName is the enum for the guild subspace.
	GuildSubspaceName
	// MemberSubspaceName is the enum for the member subspace.
	MemberSubspaceName
	// MessageSubspaceName is the enum for the message subspace.
	MessageSubspaceName
	// PresenceSubspaceName is the enum for the presence subspace.
	PresenceSubspaceName
	// UserSubspaceName is the enum for the user subspace.
	UserSubspaceName
	// RoleSubspaceName is the enum for the role subspace.
	RoleSubspaceName
	// VoiceStateSubspaceName is the enum for the voice state subspace.
	VoiceStateSubspaceName
	// EmojiSubspaceName is the enum for the emoji subspace.
	EmojiSubspaceName
	// ThreadsSubspaceName is the enum for the threads subspace.
	ThreadsSubspaceName
)

If new enums need to be added, always append. If you are deprecating an enum never delete it.

Variables

View Source
var (
	FDBRangeWantAll = fdb.RangeOptions{Mode: fdb.StreamingModeWantAll}
)

Functions

func NewDB

func NewDB() (state.DB, error)

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func (*DB) DeleteChannel

func (db *DB) DeleteChannel(_ context.Context, guild, id int64) error

func (*DB) DeleteChannelMessage

func (db *DB) DeleteChannelMessage(_ context.Context, channel, id int64) error

func (*DB) DeleteChannelMessageReaction

func (db *DB) DeleteChannelMessageReaction(_ context.Context, channel, id, user int64, name interface{}) error

func (*DB) DeleteChannelMessageReactions

func (db *DB) DeleteChannelMessageReactions(_ context.Context, channel, id, user int64) error

func (*DB) DeleteChannels

func (db *DB) DeleteChannels(_ context.Context, guild int64) error

this will leak channels in the main pool. TODO: fix

func (*DB) DeleteChannelsById

func (db *DB) DeleteChannelsById(ctx context.Context, guildID int64, channelIDs []int64) error

func (*DB) DeleteGuild

func (db *DB) DeleteGuild(_ context.Context, id int64) error

func (*DB) DeleteGuildBan

func (db *DB) DeleteGuildBan(_ context.Context, guild, user int64) error

func (*DB) DeleteGuildEmoji

func (db *DB) DeleteGuildEmoji(_ context.Context, guild, emoji int64) error

func (*DB) DeleteGuildEmojis

func (db *DB) DeleteGuildEmojis(_ context.Context, guild int64) error

func (*DB) DeleteGuildMember

func (db *DB) DeleteGuildMember(_ context.Context, guild, user int64) error

func (*DB) DeleteGuildMembers

func (db *DB) DeleteGuildMembers(_ context.Context, guild int64) error

func (*DB) DeleteGuildRole

func (db *DB) DeleteGuildRole(_ context.Context, guild, role int64) error

func (*DB) DeleteGuildRoles

func (db *DB) DeleteGuildRoles(_ context.Context, guild int64) error

func (*DB) DeleteGuildRolesById

func (db *DB) DeleteGuildRolesById(ctx context.Context, guildID int64, roleIDs []int64) error

func (*DB) DeleteThread

func (db *DB) DeleteThread(_ context.Context, id int64) error

func (*DB) DeleteThreads

func (db *DB) DeleteThreads(_ context.Context, guild int64) error

this will leak threads in the main pool. TODO: fix

func (*DB) Encoding

func (db *DB) Encoding() discord.Encoding

func (*DB) ExistUserInGuilds

func (db *DB) ExistUserInGuilds(ctx context.Context, guildIDs []int64, userID int64) (bool, error)

func (*DB) ExistUserInGuildsHasRoles

func (db *DB) ExistUserInGuildsHasRoles(ctx context.Context, guildIDs []int64, roleIDs []string, userID int64) (bool, error)

func (*DB) GetChannel

func (db *DB) GetChannel(_ context.Context, id int64) ([]byte, error)

func (*DB) GetChannelCount

func (db *DB) GetChannelCount(_ context.Context) (int, error)

func (*DB) GetChannelMessage

func (db *DB) GetChannelMessage(_ context.Context, channel, id int64) ([]byte, error)

func (*DB) GetChannelThreads

func (db *DB) GetChannelThreads(_ context.Context, channel int64) ([][]byte, error)

func (*DB) GetChannels

func (db *DB) GetChannels(_ context.Context) ([][]byte, error)

func (*DB) GetGuild

func (db *DB) GetGuild(_ context.Context, id int64) ([]byte, error)

func (*DB) GetGuildBan

func (db *DB) GetGuildBan(_ context.Context, guild, user int64) ([]byte, error)

func (*DB) GetGuildChannels

func (db *DB) GetGuildChannels(_ context.Context, guild int64) ([][]byte, error)

func (*DB) GetGuildCount

func (db *DB) GetGuildCount(_ context.Context) (int, error)

func (*DB) GetGuildEmoji

func (db *DB) GetGuildEmoji(_ context.Context, guild, emoji int64) ([]byte, error)

func (*DB) GetGuildEmojis

func (db *DB) GetGuildEmojis(_ context.Context, guild int64) ([][]byte, error)

func (*DB) GetGuildMember

func (db *DB) GetGuildMember(_ context.Context, guild, user int64) ([]byte, error)

func (*DB) GetGuildMemberCount

func (db *DB) GetGuildMemberCount(ctx context.Context, guildID int64) (int, error)

func (*DB) GetGuildMembers

func (db *DB) GetGuildMembers(_ context.Context, guild int64) ([][]byte, error)

func (*DB) GetGuildMembersWithRole

func (db *DB) GetGuildMembersWithRole(ctx context.Context, guild, role int64) ([][]byte, error)

func (*DB) GetGuildRole

func (db *DB) GetGuildRole(_ context.Context, guild, role int64) ([]byte, error)

func (*DB) GetGuildRoles

func (db *DB) GetGuildRoles(_ context.Context, guild int64) ([][]byte, error)

func (*DB) GetGuildThreads

func (db *DB) GetGuildThreads(_ context.Context, guild int64) ([][]byte, error)

func (*DB) GetResumeGatewayURL

func (db *DB) GetResumeGatewayURL(ctx context.Context, shard int, name string) (string, error)

func (*DB) GetSequence

func (db *DB) GetSequence(ctx context.Context, shard int, name string) (int64, error)

func (*DB) GetSessionID

func (db *DB) GetSessionID(ctx context.Context, shard int, name string) (string, error)

func (*DB) GetShardInfo

func (db *DB) GetShardInfo(ctx context.Context, shard int, name string) (sess string, seq int64, err error)

func (*DB) GetThread

func (db *DB) GetThread(_ context.Context, id int64) ([]byte, error)

func (*DB) GetThreads

func (db *DB) GetThreads(_ context.Context) ([][]byte, error)

func (*DB) GetThreadsCount

func (db *DB) GetThreadsCount(_ context.Context) (int, error)

func (*DB) GetUser

func (db *DB) GetUser(ctx context.Context, userID int64) ([]byte, error)

func (*DB) GetUserPresence

func (db *DB) GetUserPresence(ctx context.Context, guildID, userID int64) ([]byte, error)

func (*DB) GetUsersDiscordIdAndUsername

func (db *DB) GetUsersDiscordIdAndUsername(ctx context.Context, userIDs []int64) ([]state.UserAndData, error)

func (*DB) ReadTransact

func (db *DB) ReadTransact(fn func(t fdb.ReadTransaction) error) error

ReadTransact is a helper around (fdb.Database).ReadTransact which accepts a function that doesn't require a return value.

func (*DB) SearchGuildMembers

func (db *DB) SearchGuildMembers(ctx context.Context, guildID int64, query string) ([][]byte, error)

func (*DB) SetChannel

func (db *DB) SetChannel(_ context.Context, guild, id int64, raw []byte) error

func (*DB) SetChannelMessage

func (db *DB) SetChannelMessage(_ context.Context, channel, id int64, raw []byte) error

func (*DB) SetChannelMessageReaction

func (db *DB) SetChannelMessageReaction(_ context.Context, channel, id, user int64, name interface{}, raw []byte) error

func (*DB) SetChannels

func (db *DB) SetChannels(_ context.Context, guild int64, channels map[int64][]byte) error

func (*DB) SetGuild

func (db *DB) SetGuild(_ context.Context, id int64, raw []byte) (bool, error)

func (*DB) SetGuildBan

func (db *DB) SetGuildBan(_ context.Context, guild, user int64, raw []byte) error

func (*DB) SetGuildEmoji

func (db *DB) SetGuildEmoji(_ context.Context, guild, emoji int64, raw []byte) error

func (*DB) SetGuildEmojis

func (db *DB) SetGuildEmojis(_ context.Context, guild int64, raws map[int64][]byte) error

func (*DB) SetGuildMember

func (db *DB) SetGuildMember(_ context.Context, guild, user int64, raw []byte) error

func (*DB) SetGuildMembers

func (db *DB) SetGuildMembers(_ context.Context, guild int64, raws map[int64][]byte) error

func (*DB) SetGuildRole

func (db *DB) SetGuildRole(_ context.Context, guild, role int64, raw []byte) error

func (*DB) SetGuildRoles

func (db *DB) SetGuildRoles(_ context.Context, guild int64, roles map[int64][]byte) error

func (*DB) SetPresence

func (db *DB) SetPresence(ctx context.Context, guildID, userID int64, data []byte) error

func (*DB) SetPresences

func (db *DB) SetPresences(ctx context.Context, guildID int64, presences map[int64][]byte) error

func (*DB) SetResumeGatewayURL

func (db *DB) SetResumeGatewayURL(ctx context.Context, shard int, name string, resumeURL string) error

func (*DB) SetSequence

func (db *DB) SetSequence(ctx context.Context, shard int, name string, seq int64) error

func (*DB) SetSessionID

func (db *DB) SetSessionID(ctx context.Context, shard int, name, sess string) error

func (*DB) SetStatus

func (db *DB) SetStatus(ctx context.Context, shard int, name, sess string) error

func (*DB) SetThread

func (db *DB) SetThread(_ context.Context, guild, channel, owner, id int64, raw []byte) error

func (*DB) SetThreads

func (db *DB) SetThreads(_ context.Context, guild int64, threads map[int64][]byte) error

func (*DB) SetVoiceState

func (db *DB) SetVoiceState(_ context.Context, guild, user int64, raw []byte) error

func (*DB) Transact

func (db *DB) Transact(fn func(t fdb.Transaction) error) error

Transact is a helper around (fdb.Database).Transact which accepts a function that doesn't require a return value.

type Subspaces

type Subspaces struct {
	Channels    subspace.Subspace
	Guilds      subspace.Subspace
	Members     subspace.Subspace
	Messages    subspace.Subspace
	Presences   subspace.Subspace
	Users       subspace.Subspace
	Roles       subspace.Subspace
	VoiceStates subspace.Subspace
	Emojis      subspace.Subspace
	Threads     subspace.Subspace
}

Subspaces is a struct containing all of the different subspaces used.

func NewSubspaces

func NewSubspaces(dir directory.DirectorySubspace) *Subspaces

NewSubspaces returns an instantiated Subspaces with the correct subspaces.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL