[feature] Hashtag federation (in/out), hashtag client API endpoints (#2032)

* update go-fed

* do the things

* remove unused columns from tags

* update to latest lingo from main

* further tag shenanigans

* serve stub page at tag endpoint

* we did it lads

* tests, oh tests, ohhh tests, oh tests (doo doo doo doo)

* swagger docs

* document hashtag usage + federation

* instanceGet

* don't bother parsing tag href

* rename whereStartsWith -> whereStartsLike

* remove GetOrCreateTag

* dont cache status tag timelineability
This commit is contained in:
tobi 2023-07-31 15:47:35 +02:00 committed by GitHub
commit 2796a2e82f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
69 changed files with 2536 additions and 482 deletions

View file

@ -266,6 +266,10 @@ type GTSCacheConfiguration struct {
StatusFaveTTL time.Duration `name:"status-fave-ttl"`
StatusFaveSweepFreq time.Duration `name:"status-fave-sweep-freq"`
TagMaxSize int `name:"tag-max-size"`
TagTTL time.Duration `name:"tag-ttl"`
TagSweepFreq time.Duration `name:"tag-sweep-freq"`
TombstoneMaxSize int `name:"tombstone-max-size"`
TombstoneTTL time.Duration `name:"tombstone-ttl"`
TombstoneSweepFreq time.Duration `name:"tombstone-sweep-freq"`

View file

@ -211,6 +211,10 @@ var Defaults = Configuration{
StatusFaveTTL: time.Minute * 30,
StatusFaveSweepFreq: time.Minute,
TagMaxSize: 2000,
TagTTL: time.Minute * 30,
TagSweepFreq: time.Minute,
TombstoneMaxSize: 500,
TombstoneTTL: time.Minute * 30,
TombstoneSweepFreq: time.Minute,

View file

@ -3984,6 +3984,81 @@ func GetCacheGTSStatusFaveSweepFreq() time.Duration { return global.GetCacheGTSS
// SetCacheGTSStatusFaveSweepFreq safely sets the value for global configuration 'Cache.GTS.StatusFaveSweepFreq' field
func SetCacheGTSStatusFaveSweepFreq(v time.Duration) { global.SetCacheGTSStatusFaveSweepFreq(v) }
// GetCacheGTSTagMaxSize safely fetches the Configuration value for state's 'Cache.GTS.TagMaxSize' field
func (st *ConfigState) GetCacheGTSTagMaxSize() (v int) {
st.mutex.RLock()
v = st.config.Cache.GTS.TagMaxSize
st.mutex.RUnlock()
return
}
// SetCacheGTSTagMaxSize safely sets the Configuration value for state's 'Cache.GTS.TagMaxSize' field
func (st *ConfigState) SetCacheGTSTagMaxSize(v int) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.Cache.GTS.TagMaxSize = v
st.reloadToViper()
}
// CacheGTSTagMaxSizeFlag returns the flag name for the 'Cache.GTS.TagMaxSize' field
func CacheGTSTagMaxSizeFlag() string { return "cache-gts-tag-max-size" }
// GetCacheGTSTagMaxSize safely fetches the value for global configuration 'Cache.GTS.TagMaxSize' field
func GetCacheGTSTagMaxSize() int { return global.GetCacheGTSTagMaxSize() }
// SetCacheGTSTagMaxSize safely sets the value for global configuration 'Cache.GTS.TagMaxSize' field
func SetCacheGTSTagMaxSize(v int) { global.SetCacheGTSTagMaxSize(v) }
// GetCacheGTSTagTTL safely fetches the Configuration value for state's 'Cache.GTS.TagTTL' field
func (st *ConfigState) GetCacheGTSTagTTL() (v time.Duration) {
st.mutex.RLock()
v = st.config.Cache.GTS.TagTTL
st.mutex.RUnlock()
return
}
// SetCacheGTSTagTTL safely sets the Configuration value for state's 'Cache.GTS.TagTTL' field
func (st *ConfigState) SetCacheGTSTagTTL(v time.Duration) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.Cache.GTS.TagTTL = v
st.reloadToViper()
}
// CacheGTSTagTTLFlag returns the flag name for the 'Cache.GTS.TagTTL' field
func CacheGTSTagTTLFlag() string { return "cache-gts-tag-ttl" }
// GetCacheGTSTagTTL safely fetches the value for global configuration 'Cache.GTS.TagTTL' field
func GetCacheGTSTagTTL() time.Duration { return global.GetCacheGTSTagTTL() }
// SetCacheGTSTagTTL safely sets the value for global configuration 'Cache.GTS.TagTTL' field
func SetCacheGTSTagTTL(v time.Duration) { global.SetCacheGTSTagTTL(v) }
// GetCacheGTSTagSweepFreq safely fetches the Configuration value for state's 'Cache.GTS.TagSweepFreq' field
func (st *ConfigState) GetCacheGTSTagSweepFreq() (v time.Duration) {
st.mutex.RLock()
v = st.config.Cache.GTS.TagSweepFreq
st.mutex.RUnlock()
return
}
// SetCacheGTSTagSweepFreq safely sets the Configuration value for state's 'Cache.GTS.TagSweepFreq' field
func (st *ConfigState) SetCacheGTSTagSweepFreq(v time.Duration) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.Cache.GTS.TagSweepFreq = v
st.reloadToViper()
}
// CacheGTSTagSweepFreqFlag returns the flag name for the 'Cache.GTS.TagSweepFreq' field
func CacheGTSTagSweepFreqFlag() string { return "cache-gts-tag-sweep-freq" }
// GetCacheGTSTagSweepFreq safely fetches the value for global configuration 'Cache.GTS.TagSweepFreq' field
func GetCacheGTSTagSweepFreq() time.Duration { return global.GetCacheGTSTagSweepFreq() }
// SetCacheGTSTagSweepFreq safely sets the value for global configuration 'Cache.GTS.TagSweepFreq' field
func SetCacheGTSTagSweepFreq(v time.Duration) { global.SetCacheGTSTagSweepFreq(v) }
// GetCacheGTSTombstoneMaxSize safely fetches the Configuration value for state's 'Cache.GTS.TombstoneMaxSize' field
func (st *ConfigState) GetCacheGTSTombstoneMaxSize() (v int) {
st.mutex.RLock()