forked from TrueCloudLab/frostfs-node
[#1255] node/session: Add persistent session storage
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
929c9851a6
commit
455b9fb325
7 changed files with 331 additions and 20 deletions
38
pkg/services/session/storage/persistent/options.go
Normal file
38
pkg/services/session/storage/persistent/options.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package persistent
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type cfg struct {
|
||||
l *zap.Logger
|
||||
timeout time.Duration
|
||||
}
|
||||
|
||||
// Option allows setting optional parameters of the TokenStore.
|
||||
type Option func(*cfg)
|
||||
|
||||
func defaultCfg() *cfg {
|
||||
return &cfg{
|
||||
l: zap.L(),
|
||||
timeout: 100 * time.Millisecond,
|
||||
}
|
||||
}
|
||||
|
||||
// WithLogger returns an option to specify
|
||||
// logger.
|
||||
func WithLogger(v *zap.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.l = v
|
||||
}
|
||||
}
|
||||
|
||||
// WithTimeout returns option to specify
|
||||
// database connection timeout.
|
||||
func WithTimeout(v time.Duration) Option {
|
||||
return func(c *cfg) {
|
||||
c.timeout = v
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue