Documentation ¶
Index ¶
- func ClearCache()
- func DeleteFromCache(id types.Binary)
- func ID(source int64, tags map[string]string) types.Binary
- func RestoreMutedObjects(ctx context.Context, db *database.DB) error
- func RestoreObjects(ctx context.Context, db *database.DB, ids []types.Binary) error
- type ExtraTagRow
- type IdTagRow
- type Object
- func (o *Object) DisplayName() string
- func (o *Object) EvalEqual(key string, value string) (bool, error)
- func (o *Object) EvalExists(key string) bool
- func (o *Object) EvalLess(key string, value string) (bool, error)
- func (o *Object) EvalLessOrEqual(key string, value string) (bool, error)
- func (o *Object) EvalLike(key string, value string) (bool, error)
- func (o *Object) IsMuted() bool
- func (o *Object) String() string
- func (o *Object) Upsert() interface{}
- type TagRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearCache ¶
func ClearCache()
ClearCache clears the global object cache store. Note, this is only used for unit tests not to run into "can't cache already cached object" error.
func DeleteFromCache ¶
DeleteFromCache deletes the Object from the global cache store matching the given ID (if any).
func RestoreMutedObjects ¶
RestoreMutedObjects restores all muted objects and their extra / ID tags from the database. Note, this function only retrieves muted objects without non-recovered incident.
Returns an error on any database failure and panics when trying to cache an object that's already in the cache store.
func RestoreObjects ¶
RestoreObjects restores all objects and their (extra)tags matching the given IDs from the database. Returns error on any database failures and panics when trying to cache an object that's already in the cache store.
Types ¶
type ExtraTagRow ¶
type ExtraTagRow TagRow
ExtraTagRow represents a single database object extra tag like `hostgroup/foo: null`.
func (*ExtraTagRow) TableName ¶
func (e *ExtraTagRow) TableName() string
TableName implements the contracts.TableNamer interface.
type Object ¶
type Object struct { ID types.Binary `db:"id"` SourceID int64 `db:"source_id"` Name string `db:"name"` URL types.String `db:"url"` MuteReason types.String `db:"mute_reason"` Tags map[string]string `db:"-"` ExtraTags map[string]string `db:"-"` // contains filtered or unexported fields }
func FromEvent ¶
FromEvent creates an object from the provided event tags if it's not in the cache and syncs all object related types with the database. Returns error on any database failure
func GetFromCache ¶
GetFromCache fetches an object from the global object cache store matching the given ID. Returns nil if it's not in the cache.
func (*Object) DisplayName ¶
func (*Object) EvalExists ¶
func (*Object) EvalLessOrEqual ¶
func (*Object) EvalLike ¶
EvalLike returns true when the objects tag/value matches the filter.Conditional value.