mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-01 11:26:29 +02:00
* refactor backend, implement encrypted store * refactor in-memory store * wip * wip * wip * add syncer test * fix redis expiry * fix linting issues * fix test by skipping non-config records * fix backoff import * fix init issues * fix query * wait for initial sync before starting directory sync * add type to SyncLatest * add more log messages, fix deadlock in in-memory store, always return server version from SyncLatest * update sync types and tests * add redis tests * skip macos in github actions * add comments to proto * split getBackend into separate methods * handle errors in initVersion * return different error for not found vs other errors in get * use exponential backoff for redis transaction retry * rename raw to result * use context instead of close channel * store type urls as constants in databroker * use timestampb instead of ptypes * fix group merging not waiting * change locked names * update GetAll to return latest record version * add method to grpcutil to get the type url for a protobuf type
36 lines
640 B
Go
36 lines
640 B
Go
package inmemory
|
|
|
|
import "time"
|
|
|
|
type config struct {
|
|
degree int
|
|
expiry time.Duration
|
|
}
|
|
|
|
// An Option customizes the in-memory backend.
|
|
type Option func(cfg *config)
|
|
|
|
func getConfig(options ...Option) *config {
|
|
cfg := &config{
|
|
degree: 16,
|
|
expiry: time.Hour,
|
|
}
|
|
for _, option := range options {
|
|
option(cfg)
|
|
}
|
|
return cfg
|
|
}
|
|
|
|
// WithBTreeDegree sets the btree degree of the changes btree.
|
|
func WithBTreeDegree(degree int) Option {
|
|
return func(cfg *config) {
|
|
cfg.degree = degree
|
|
}
|
|
}
|
|
|
|
// WithExpiry sets the expiry for changes.
|
|
func WithExpiry(expiry time.Duration) Option {
|
|
return func(cfg *config) {
|
|
cfg.expiry = expiry
|
|
}
|
|
}
|