micro/store/options.go
ben-toogood d621548120
Auth (#1147)
Implement the Auth interface, with JWT and service implementations.

* Update Auth Interface

* Define Auth Service Implementation

* Support Service Auth

* Add Auth Service Proto

* Remove erronious files

* Implement Auth Service Package

* Update Auth Interface

* Update Auth Interface. Add Validate, remove Add/Remove roles

* Make Revoke interface more explicit

* Refactor serializing and deserializing service accounts

* Fix srv name & update interface to be more explicit

* Require jwt public key for auth

* Rename Variables (Resource.ID => Resource.Name & ServiceAccount => Account)

* Implement JWT Auth Package

* Remove parent, add ID

* Update auth imports to v2. Add String() to auth interface
2020-02-03 08:16:02 +00:00

57 lines
1000 B
Go

package store
import (
"context"
)
type Options struct {
// nodes to connect to
Nodes []string
// Namespace of the store
Namespace string
// Prefix of the keys used
Prefix string
// Suffix of the keys used
Suffix string
// Alternative options
Context context.Context
}
type Option func(o *Options)
// Nodes is a list of nodes used to back the store
func Nodes(a ...string) Option {
return func(o *Options) {
o.Nodes = a
}
}
// Prefix sets a prefix to any key ids used
func Prefix(p string) Option {
return func(o *Options) {
o.Prefix = p
}
}
// Namespace offers a way to have multiple isolated
// stores in the same backend, if supported.
func Namespace(ns string) Option {
return func(o *Options) {
o.Namespace = ns
}
}
// ReadPrefix uses the key as a prefix
func ReadPrefix() ReadOption {
return func(o *ReadOptions) {
o.Prefix = true
}
}
// ReadSuffix uses the key as a suffix
func ReadSuffix() ReadOption {
return func(o *ReadOptions) {
o.Suffix = true
}
}