MCPcopy Create free account
hub / github.com/cortexproject/cortex / GetRulesConfig

Method GetRulesConfig

pkg/configs/db/memory/memory.go:92–102  ·  view source on GitHub ↗

GetRulesConfig gets the rules config for a user.

(ctx context.Context, userID string)

Source from the content-addressed store, hash-verified

90
91// GetRulesConfig gets the rules config for a user.
92func (d *DB) GetRulesConfig(ctx context.Context, userID string) (userconfig.VersionedRulesConfig, error) {
93 c, ok := d.cfgs[userID]
94 if !ok {
95 return userconfig.VersionedRulesConfig{}, sql.ErrNoRows
96 }
97 cfg := c.GetVersionedRulesConfig()
98 if cfg == nil {
99 return userconfig.VersionedRulesConfig{}, sql.ErrNoRows
100 }
101 return *cfg, nil
102}
103
104// SetRulesConfig sets the rules config for a user.
105func (d *DB) SetRulesConfig(ctx context.Context, userID string, oldConfig, newConfig userconfig.RulesConfig) (bool, error) {

Callers

nothing calls this directly

Implementers 4

timedpkg/configs/db/timed.go
tracedpkg/configs/db/traced.go
DBpkg/configs/db/postgres/postgres.go
DBpkg/configs/db/memory/memory.go

Calls 1

Tested by

no test coverage detected