From 61a2b91f454a6eb0dd383fc8614fee154654fa08 Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Wed, 6 Mar 2024 02:15:58 -0800 Subject: [feature] Filters v1 (#2594) * Implement client-side v1 filters * Exclude linter false positives * Update test/envparsing.sh * Fix minor Swagger, style, and Bun usage issues * Regenerate Swagger * De-generify filter keywords * Remove updating filter statuses This is an operation that the Mastodon v2 filter API doesn't actually have, because filter statuses, unlike keywords, don't have options: the only info they contain is the status ID to be filtered. * Add a test for filter statuses specifically * De-generify filter statuses * Inline FilterEntry * Use vertical style for Bun operations consistently * Add comment on Filter DB interface * Remove GoLand linter control comments Our existing linters should catch these, or they don't matter very much * Reduce memory ratio for filters --- internal/config/helpers.gen.go | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'internal/config/helpers.gen.go') diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index f458074b1..c5d4c992b 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -2975,6 +2975,81 @@ func GetCacheEmojiCategoryMemRatio() float64 { return global.GetCacheEmojiCatego // SetCacheEmojiCategoryMemRatio safely sets the value for global configuration 'Cache.EmojiCategoryMemRatio' field func SetCacheEmojiCategoryMemRatio(v float64) { global.SetCacheEmojiCategoryMemRatio(v) } +// GetCacheFilterMemRatio safely fetches the Configuration value for state's 'Cache.FilterMemRatio' field +func (st *ConfigState) GetCacheFilterMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.FilterMemRatio + st.mutex.RUnlock() + return +} + +// SetCacheFilterMemRatio safely sets the Configuration value for state's 'Cache.FilterMemRatio' field +func (st *ConfigState) SetCacheFilterMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.FilterMemRatio = v + st.reloadToViper() +} + +// CacheFilterMemRatioFlag returns the flag name for the 'Cache.FilterMemRatio' field +func CacheFilterMemRatioFlag() string { return "cache-filter-mem-ratio" } + +// GetCacheFilterMemRatio safely fetches the value for global configuration 'Cache.FilterMemRatio' field +func GetCacheFilterMemRatio() float64 { return global.GetCacheFilterMemRatio() } + +// SetCacheFilterMemRatio safely sets the value for global configuration 'Cache.FilterMemRatio' field +func SetCacheFilterMemRatio(v float64) { global.SetCacheFilterMemRatio(v) } + +// GetCacheFilterKeywordMemRatio safely fetches the Configuration value for state's 'Cache.FilterKeywordMemRatio' field +func (st *ConfigState) GetCacheFilterKeywordMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.FilterKeywordMemRatio + st.mutex.RUnlock() + return +} + +// SetCacheFilterKeywordMemRatio safely sets the Configuration value for state's 'Cache.FilterKeywordMemRatio' field +func (st *ConfigState) SetCacheFilterKeywordMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.FilterKeywordMemRatio = v + st.reloadToViper() +} + +// CacheFilterKeywordMemRatioFlag returns the flag name for the 'Cache.FilterKeywordMemRatio' field +func CacheFilterKeywordMemRatioFlag() string { return "cache-filter-keyword-mem-ratio" } + +// GetCacheFilterKeywordMemRatio safely fetches the value for global configuration 'Cache.FilterKeywordMemRatio' field +func GetCacheFilterKeywordMemRatio() float64 { return global.GetCacheFilterKeywordMemRatio() } + +// SetCacheFilterKeywordMemRatio safely sets the value for global configuration 'Cache.FilterKeywordMemRatio' field +func SetCacheFilterKeywordMemRatio(v float64) { global.SetCacheFilterKeywordMemRatio(v) } + +// GetCacheFilterStatusMemRatio safely fetches the Configuration value for state's 'Cache.FilterStatusMemRatio' field +func (st *ConfigState) GetCacheFilterStatusMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.FilterStatusMemRatio + st.mutex.RUnlock() + return +} + +// SetCacheFilterStatusMemRatio safely sets the Configuration value for state's 'Cache.FilterStatusMemRatio' field +func (st *ConfigState) SetCacheFilterStatusMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.FilterStatusMemRatio = v + st.reloadToViper() +} + +// CacheFilterStatusMemRatioFlag returns the flag name for the 'Cache.FilterStatusMemRatio' field +func CacheFilterStatusMemRatioFlag() string { return "cache-filter-status-mem-ratio" } + +// GetCacheFilterStatusMemRatio safely fetches the value for global configuration 'Cache.FilterStatusMemRatio' field +func GetCacheFilterStatusMemRatio() float64 { return global.GetCacheFilterStatusMemRatio() } + +// SetCacheFilterStatusMemRatio safely sets the value for global configuration 'Cache.FilterStatusMemRatio' field +func SetCacheFilterStatusMemRatio(v float64) { global.SetCacheFilterStatusMemRatio(v) } + // GetCacheFollowMemRatio safely fetches the Configuration value for state's 'Cache.FollowMemRatio' field func (st *ConfigState) GetCacheFollowMemRatio() (v float64) { st.mutex.RLock() -- cgit v1.2.3