Documentation ¶
Index ¶
- Constants
- Variables
- type APCaches
- type CachedVisibility
- type Caches
- type GTSCaches
- func (c *GTSCaches) Account() *result.Cache[*gtsmodel.Account]
- func (c *GTSCaches) AccountNote() *result.Cache[*gtsmodel.AccountNote]
- func (c *GTSCaches) Application() *result.Cache[*gtsmodel.Application]
- func (c *GTSCaches) Block() *result.Cache[*gtsmodel.Block]
- func (c *GTSCaches) BlockIDs() *SliceCache[string]
- func (c *GTSCaches) BoostOfIDs() *SliceCache[string]
- func (c *GTSCaches) DomainAllow() *domain.Cache
- func (c *GTSCaches) DomainBlock() *domain.Cache
- func (c *GTSCaches) Emoji() *result.Cache[*gtsmodel.Emoji]
- func (c *GTSCaches) EmojiCategory() *result.Cache[*gtsmodel.EmojiCategory]
- func (c *GTSCaches) Follow() *result.Cache[*gtsmodel.Follow]
- func (c *GTSCaches) FollowIDs() *SliceCache[string]
- func (c *GTSCaches) FollowRequest() *result.Cache[*gtsmodel.FollowRequest]
- func (c *GTSCaches) FollowRequestIDs() *SliceCache[string]
- func (c *GTSCaches) InReplyToIDs() *SliceCache[string]
- func (c *GTSCaches) Init()
- func (c *GTSCaches) Instance() *result.Cache[*gtsmodel.Instance]
- func (c *GTSCaches) List() *result.Cache[*gtsmodel.List]
- func (c *GTSCaches) ListEntry() *result.Cache[*gtsmodel.ListEntry]
- func (c *GTSCaches) Marker() *result.Cache[*gtsmodel.Marker]
- func (c *GTSCaches) Media() *result.Cache[*gtsmodel.MediaAttachment]
- func (c *GTSCaches) Mention() *result.Cache[*gtsmodel.Mention]
- func (c *GTSCaches) Notification() *result.Cache[*gtsmodel.Notification]
- func (c *GTSCaches) Report() *result.Cache[*gtsmodel.Report]
- func (c *GTSCaches) Start()
- func (c *GTSCaches) Status() *result.Cache[*gtsmodel.Status]
- func (c *GTSCaches) StatusFave() *result.Cache[*gtsmodel.StatusFave]
- func (c *GTSCaches) StatusFaveIDs() *SliceCache[string]
- func (c *GTSCaches) Stop()
- func (c *GTSCaches) Tag() *result.Cache[*gtsmodel.Tag]
- func (c *GTSCaches) Tombstone() *result.Cache[*gtsmodel.Tombstone]
- func (c *GTSCaches) User() *result.Cache[*gtsmodel.User]
- func (c *GTSCaches) Webfinger() *ttl.Cache[string, string]
- type SliceCache
- type VisibilityCache
- type VisibilityType
Constants ¶
const ( // Possible cache visibility lookup types. VisibilityTypeAccount = VisibilityType('a') VisibilityTypeStatus = VisibilityType('s') VisibilityTypeHome = VisibilityType('h') VisibilityTypePublic = VisibilityType('p') )
Variables ¶
var SentinelError = errors.New("BUG: error should not be returned") //nolint:revive
SentinelError is an error that can be returned and checked against to indicate a non-permanent error return from a cache loader callback, e.g. a temporary situation that will soon be fixed.
Functions ¶
This section is empty.
Types ¶
type APCaches ¶ added in v0.7.0
type APCaches struct{}
func (*APCaches) Init ¶ added in v0.7.0
func (c *APCaches) Init()
Init will initialize all the ActivityPub caches in this collection. NOTE: the cache MUST NOT be in use anywhere, this is not thread-safe.
type CachedVisibility ¶ added in v0.8.0
type CachedVisibility struct { // ItemID is the ID of the item in question (status / account). ItemID string // RequesterID is the ID of the requesting account for this visibility lookup. RequesterID string // Type is the visibility lookup type. Type VisibilityType // Value is the actual visibility value. Value bool }
CachedVisibility represents a cached visibility lookup value.
type Caches ¶ added in v0.7.0
type Caches struct { // GTS provides access to the collection of gtsmodel object caches. // (used by the database). GTS GTSCaches // AP provides access to the collection of ActivityPub object caches. // (planned to be used by the typeconverter). AP APCaches // Visibility provides access to the item visibility cache. // (used by the visibility filter). Visibility VisibilityCache // contains filtered or unexported fields }
func (*Caches) Init ¶ added in v0.7.0
func (c *Caches) Init()
Init will (re)initialize both the GTS and AP cache collections. NOTE: the cache MUST NOT be in use anywhere, this is not thread-safe.
func (*Caches) Start ¶ added in v0.7.0
func (c *Caches) Start()
Start will start both the GTS and AP cache collections.
func (*Caches) Stop ¶ added in v0.7.0
func (c *Caches) Stop()
Stop will stop both the GTS and AP cache collections.
func (*Caches) Sweep ¶ added in v0.11.0
Sweep will sweep all the available caches to ensure none are above threshold percent full to their total capacity.
This helps with cache performance, as a full cache will require an eviction on every single write, which adds significant overhead to all cache writes.
type GTSCaches ¶ added in v0.7.0
type GTSCaches struct {
// contains filtered or unexported fields
}
func (*GTSCaches) Account ¶ added in v0.7.0
Account provides access to the gtsmodel Account database cache.
func (*GTSCaches) AccountNote ¶ added in v0.11.0
func (c *GTSCaches) AccountNote() *result.Cache[*gtsmodel.AccountNote]
AccountNote provides access to the gtsmodel Note database cache.
func (*GTSCaches) Application ¶ added in v0.11.0
func (c *GTSCaches) Application() *result.Cache[*gtsmodel.Application]
Application provides access to the gtsmodel Application database cache.
func (*GTSCaches) Block ¶ added in v0.7.0
Block provides access to the gtsmodel Block (account) database cache.
func (*GTSCaches) BlockIDs ¶ added in v0.11.0
func (c *GTSCaches) BlockIDs() *SliceCache[string]
FollowIDs provides access to the block IDs database cache.
func (*GTSCaches) BoostOfIDs ¶ added in v0.11.0
func (c *GTSCaches) BoostOfIDs() *SliceCache[string]
BoostOfIDs provides access to the boost of IDs list database cache.
func (*GTSCaches) DomainAllow ¶ added in v0.12.0
DomainAllow provides access to the domain allow database cache.
func (*GTSCaches) DomainBlock ¶ added in v0.7.0
DomainBlock provides access to the domain block database cache.
func (*GTSCaches) Emoji ¶ added in v0.7.0
Emoji provides access to the gtsmodel Emoji database cache.
func (*GTSCaches) EmojiCategory ¶ added in v0.7.0
func (c *GTSCaches) EmojiCategory() *result.Cache[*gtsmodel.EmojiCategory]
EmojiCategory provides access to the gtsmodel EmojiCategory database cache.
func (*GTSCaches) Follow ¶ added in v0.8.0
Follow provides access to the gtsmodel Follow database cache.
func (*GTSCaches) FollowIDs ¶ added in v0.11.0
func (c *GTSCaches) FollowIDs() *SliceCache[string]
FollowIDs provides access to the follower / following IDs database cache. THIS CACHE IS KEYED AS THE FOLLOWING {prefix}{accountID} WHERE PREFIX IS: - '>' for following IDs - 'l>' for local following IDs - '<' for follower IDs - 'l<' for local follower IDs
func (*GTSCaches) FollowRequest ¶ added in v0.8.0
func (c *GTSCaches) FollowRequest() *result.Cache[*gtsmodel.FollowRequest]
FollowRequest provides access to the gtsmodel FollowRequest database cache.
func (*GTSCaches) FollowRequestIDs ¶ added in v0.11.0
func (c *GTSCaches) FollowRequestIDs() *SliceCache[string]
FollowRequestIDs provides access to the follow requester / requesting IDs database cache. THIS CACHE IS KEYED AS THE FOLLOWING {prefix}{accountID} WHERE PREFIX IS: - '>' for following IDs - '<' for follower IDs
func (*GTSCaches) InReplyToIDs ¶ added in v0.11.0
func (c *GTSCaches) InReplyToIDs() *SliceCache[string]
InReplyToIDs provides access to the status in reply to IDs list database cache.
func (*GTSCaches) Init ¶ added in v0.7.0
func (c *GTSCaches) Init()
Init will initialize all the gtsmodel caches in this collection. NOTE: the cache MUST NOT be in use anywhere, this is not thread-safe.
func (*GTSCaches) Instance ¶ added in v0.10.0
Instance provides access to the gtsmodel Instance database cache.
func (*GTSCaches) ListEntry ¶ added in v0.10.0
ListEntry provides access to the gtsmodel ListEntry database cache.
func (*GTSCaches) Marker ¶ added in v0.11.0
Marker provides access to the gtsmodel Marker database cache.
func (*GTSCaches) Media ¶ added in v0.8.0
func (c *GTSCaches) Media() *result.Cache[*gtsmodel.MediaAttachment]
Media provides access to the gtsmodel Media database cache.
func (*GTSCaches) Mention ¶ added in v0.7.0
Mention provides access to the gtsmodel Mention database cache.
func (*GTSCaches) Notification ¶ added in v0.7.0
func (c *GTSCaches) Notification() *result.Cache[*gtsmodel.Notification]
Notification provides access to the gtsmodel Notification database cache.
func (*GTSCaches) Report ¶ added in v0.7.0
Report provides access to the gtsmodel Report database cache.
func (*GTSCaches) Start ¶ added in v0.7.0
func (c *GTSCaches) Start()
Start will attempt to start all of the gtsmodel caches, or panic.
func (*GTSCaches) Status ¶ added in v0.7.0
Status provides access to the gtsmodel Status database cache.
func (*GTSCaches) StatusFave ¶ added in v0.8.0
func (c *GTSCaches) StatusFave() *result.Cache[*gtsmodel.StatusFave]
StatusFave provides access to the gtsmodel StatusFave database cache.
func (*GTSCaches) StatusFaveIDs ¶ added in v0.11.0
func (c *GTSCaches) StatusFaveIDs() *SliceCache[string]
StatusFaveIDs provides access to the status fave IDs list database cache.
func (*GTSCaches) Stop ¶ added in v0.7.0
func (c *GTSCaches) Stop()
Stop will attempt to stop all of the gtsmodel caches, or panic.
func (*GTSCaches) Tombstone ¶ added in v0.7.0
Tombstone provides access to the gtsmodel Tombstone database cache.
type SliceCache ¶ added in v0.11.0
SliceCache wraps a simple.Cache to provide simple loader-callback functions for fetching + caching slices of objects (e.g. IDs).
type VisibilityCache ¶ added in v0.8.0
type VisibilityCache struct { *result.Cache[*CachedVisibility] }
func (*VisibilityCache) Init ¶ added in v0.8.0
func (c *VisibilityCache) Init()
Init will initialize the visibility cache in this collection. NOTE: the cache MUST NOT be in use anywhere, this is not thread-safe.
func (*VisibilityCache) Start ¶ added in v0.8.0
func (c *VisibilityCache) Start()
Start will attempt to start the visibility cache, or panic.
func (*VisibilityCache) Stop ¶ added in v0.8.0
func (c *VisibilityCache) Stop()
Stop will attempt to stop the visibility cache, or panic.
type VisibilityType ¶ added in v0.8.0
type VisibilityType byte
VisibilityType represents a visibility lookup type. We use a byte type here to improve performance in the result cache when generating the key.