featureflags

package
v2.37.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddManualGuildFlags

func AddManualGuildFlags(guildID int64, flags ...string) error

in some scenarios manual flag management is usefull and since updating flags dosen't trample over unknown flags its completely reliable aswelll

func BatchInitCache

func BatchInitCache(guilds []int64) error

func EvictCacheForGuild

func EvictCacheForGuild(guildID int64)

EvictCacheForGuild evicts the specified guild's featureflag cache

func GetGuildFlags

func GetGuildFlags(guildID int64) ([]string, error)

GetGuildFlags returns the feature flags a guild has

func GuildHasFlag

func GuildHasFlag(guildID int64, flag string) (bool, error)

GuildHasFlag returns true if the target guild has the provided flag

func GuildHasFlagOrLogError

func GuildHasFlagOrLogError(guildID int64, flag string) bool

GuildHasFlagOrLogError is the same as GuildHasFlag but will handle the error and log it

func MarkGuildDirty

func MarkGuildDirty(guildID int64)

MarkGuildDirty marks a guild's feature flags dirty

func RegisterPlugin

func RegisterPlugin()

RegisterPlugin registers the mqueue plugin into the plugin system and also initializes it

func RemoveManualGuildFlags

func RemoveManualGuildFlags(guildID int64, flags ...string) error

in some scenarios manual flag management is usefull and since updating flags dosen't trample over unknown flags its completely reliable aswelll

func RetryGetGuildFlags

func RetryGetGuildFlags(guildID int64) (flags []string, err error)

RetryGetGuildFlags is the same as GetGuildFlags but will retry fetching the flags up to around 2 minutes before giving up on errors

func UpdateGuildFlags

func UpdateGuildFlags(guildID int64) error

UpdateGuildFlags updates the provided guilds feature flags

func UpdatePluginFeatureFlags

func UpdatePluginFeatureFlags(guildID int64, p PluginWithFeatureFlags) error

UpdatePluginFeatureFlags updates the feature flags of the provided plugin for the provided guild

Types

type EvictCacheData

type EvictCacheData struct {
	GuildID int64 `json:"guild_id"`
}

type Plugin

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

Plugin represents the mqueue plugin

func (*Plugin) BatchInitialPluginUpdater

func (p *Plugin) BatchInitialPluginUpdater(pbf PluginWithBatchFeatureFlags) error

Does a sparse initial update for new feature flags This is only used in cases where the feature flags can be calculated in a batch to save time This does NOT remove any flags so its purely to intiially populate the flags It should also run fairly fast since its blocking normal operation

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() *common.PluginInfo

PluginInfo implements common.Plugin

func (*Plugin) RunBackgroundWorker

func (p *Plugin) RunBackgroundWorker()

RunBackgroundWorker implements backgroundworkers.BackgroundWorkerPlugin

func (*Plugin) StopBackgroundWorker

func (p *Plugin) StopBackgroundWorker(wg *sync.WaitGroup)

StopBackgroundWorker implements backgroundworkers.BackgroundWorkerPlugin

type PluginWithBatchFeatureFlags

type PluginWithBatchFeatureFlags interface {
	PluginWithFeatureFlags

	UpdateFeatureFlagsBatch() (map[int64][]string, error)
}

this provides a way to batch update flags initially during init for example with premium, we can get all the premium guilds in 1 db query as opposed to querying each individual guild individually

type PluginWithFeatureFlags

type PluginWithFeatureFlags interface {
	common.Plugin

	UpdateFeatureFlags(guildID int64) ([]string, error)
	AllFeatureFlags() []string
}

PluginWithFeatureFlags is a interface for plugins that provide their own feature-flags

Jump to

Keyboard shortcuts

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