MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / newStore

Function newStore

pkg/ratelimit/config.go:93–101  ·  view source on GitHub ↗
(conf StoreConfig)

Source from the content-addressed store, hash-verified

91var errInvalidRate = errors.DefineInvalidArgument("invalid_rate", "invalid rate `{rate}` for profile `{name}`")
92
93func newStore(conf StoreConfig) (store throttled.GCRAStoreCtx, err error) {
94 switch conf.Provider {
95 case "redis":
96 return redisstore.NewCtx(conf.Redis, conf.Redis.Key(""))
97
98 default:
99 return memstore.NewCtx(int(conf.Memory.MaxSize))
100 }
101}
102
103// NewProfile returns a new ratelimit.Interface from profile configuration.
104func NewProfile(ctx context.Context, conf config.RateLimitingProfile, storeConf StoreConfig) (Interface, error) {

Callers 1

NewProfileFunction · 0.70

Calls 1

KeyMethod · 0.65

Tested by

no test coverage detected