Documentation
¶
Overview ¶
Package redisstore registers a Redis-backed SpendStore. Import with a blank import to activate it:
import _ "github.com/arkonis-dev/ark/pkg/costs/redisstore"
Index ¶
- type RedisSpendStore
- func (s *RedisSpendStore) Record(ctx context.Context, entry costs.SpendEntry) error
- func (s *RedisSpendStore) Rollup(ctx context.Context, scope costs.SpendScope, period costs.Period, ...) ([]costs.RollupEntry, error)
- func (s *RedisSpendStore) Total(ctx context.Context, scope costs.SpendScope, since time.Time) (float64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisSpendStore ¶
type RedisSpendStore struct {
// contains filtered or unexported fields
}
RedisSpendStore stores SpendEntry values in Redis sorted sets.
Storage layout:
ark:spend:<namespace>.<team> → sorted set, score = unix ms, value = JSON SpendEntry ark:spend:_all → same entries, for cross-namespace queries
func New ¶
func New(url string) (*RedisSpendStore, error)
New creates a RedisSpendStore from a Redis URL (redis://...).
func (*RedisSpendStore) Record ¶
func (s *RedisSpendStore) Record(ctx context.Context, entry costs.SpendEntry) error
Record saves one SpendEntry into the namespace+team sorted set and the global set.
func (*RedisSpendStore) Rollup ¶
func (s *RedisSpendStore) Rollup( ctx context.Context, scope costs.SpendScope, period costs.Period, since time.Time, ) ([]costs.RollupEntry, error)
Rollup returns spend grouped into period buckets for the given scope.
Click to show internal directories.
Click to hide internal directories.