Documentation
¶
Index ¶
- Variables
- func StoreFlagSet() (*flag.FlagSet, func() StoreConfig)
- type AttributeKey
- type AttributeValue
- type Attributes
- type Component
- type DN
- type Entry
- type Mem
- func (m *Mem) Begin(ctx context.Context) (Transaction, error)
- func (m *Mem) List(ctx context.Context, prefix Prefix, exact bool) (entries []Entry, err error)
- func (m *Mem) Metrics() []prometheus.Collector
- func (m *Mem) Ping(_ context.Context) error
- func (m *Mem) ReadinessChecks() map[string]observability.Check
- func (m *Mem) Run(ctx context.Context, notify run.Notify) error
- type MemTransaction
- type PSQL
- func (p *PSQL) Begin(ctx context.Context) (Transaction, error)
- func (p *PSQL) List(ctx context.Context, prefix Prefix, exact bool) (entries []Entry, _ error)
- func (p *PSQL) Metrics() []prometheus.Collector
- func (p *PSQL) Ping(ctx context.Context) error
- func (p *PSQL) ReadinessChecks() map[string]observability.Check
- func (p *PSQL) Run(ctx context.Context, notify run.Notify) error
- type PSQLTransaction
- type Prefix
- type Store
- type StoreConfig
- type Transaction
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingEquals = errors.New("missing = in DN, expected exactly one") ErrInvalidComponent = errors.New("invalid component") )
var ErrCommitted = errors.New("transaction already committed")
var (
ErrInvalidBackend = errors.New("invalid backend")
)
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func StoreFlagSet ¶
func StoreFlagSet() (*flag.FlagSet, func() StoreConfig)
Types ¶
type AttributeKey ¶
type AttributeKey string
func NewAttributeKey ¶
func NewAttributeKey(key string) AttributeKey
func (AttributeKey) EqualFold ¶
func (ak1 AttributeKey) EqualFold(ak2 AttributeKey) bool
type AttributeValue ¶
type AttributeValue []string
type Attributes ¶
type Attributes map[AttributeKey]AttributeValue
func (Attributes) Get ¶
func (attrs Attributes) Get(key AttributeKey) AttributeValue
type Entry ¶
type Entry struct {
DN DN
Attributes Attributes
}
func NewEntry ¶
func NewEntry(dn DN, attributes Attributes) Entry
func (*Entry) Get ¶
func (e *Entry) Get(key AttributeKey) AttributeValue
type Mem ¶
type Mem struct {
// contains filtered or unexported fields
}
func (*Mem) Metrics ¶ added in v0.0.15
func (m *Mem) Metrics() []prometheus.Collector
Metrics implements observability.Metrics.
func (*Mem) ReadinessChecks ¶ added in v0.0.16
func (m *Mem) ReadinessChecks() map[string]observability.Check
ReadinessChecks implements run.ReadinessChecks
This is a no-op.
type MemTransaction ¶
type MemTransaction struct {
// contains filtered or unexported fields
}
type PSQL ¶
type PSQL struct {
// contains filtered or unexported fields
}
func (*PSQL) Begin ¶
func (p *PSQL) Begin(ctx context.Context) (Transaction, error)
Begin implements Store.
func (*PSQL) Metrics ¶ added in v0.0.15
func (p *PSQL) Metrics() []prometheus.Collector
Metrics implements observability.Metrics.
func (*PSQL) ReadinessChecks ¶ added in v0.0.16
func (p *PSQL) ReadinessChecks() map[string]observability.Check
ReadinessChecks implements run.ReadinessChecks.
type PSQLTransaction ¶
type PSQLTransaction struct {
// contains filtered or unexported fields
}
func (*PSQLTransaction) Commit ¶
func (p *PSQLTransaction) Commit(ctx context.Context) (err error)
Commit implements Transaction.
type Prefix ¶
type Prefix []Component
Prefix is the reverse of a DN and can be used to recursively enumerate the directory. If you take two DNs (of length n and m respectively) and get their prefixes, you can check if the two DNs are one subtree of the other by checking if the fist min(n, m) parts match. For example: DN1: dc=teapot,dc=ovh PR1: dc=ovh/dc=teapot DN2: ou=users,dc=teapot,dc=ovh PR2: dc=ovh/dc=teapot/ou=users Checking if strings.HasPrefix(PR1, PR2) will tell you if one is subtree of the other.
func ParsePrefix ¶
func PrefixFromString ¶ added in v0.0.16
func (Prefix) IsPrefixOf ¶
type Store ¶
type Store interface {
run.Runnable
observability.Metrics
observability.ReadinessChecks
// Ping allows pinging the store to verify that it is ready to accept requests
Ping(ctx context.Context) error
// Lists all entries under the provided prefix DN. If exact is true, only
// entries exactly matching this DN.
List(ctx context.Context, prefix Prefix, exact bool) ([]Entry, error)
// Begin starts a transaction through which the contents on the store can be modified.
Begin(ctx context.Context) (Transaction, error)
}
Store provides an interface implemented by all types of stores for LDAP entries.
type Transaction ¶
type Transaction interface {
// Store inserts or updates an entry in the store.
Store(ctx context.Context, entry Entry) error
// Delete deletes the entry with the specified DN.
Delete(ctx context.Context, dn DN) error
// Commit permanently saves the changes made through this transaction to the store.
Commit(ctx context.Context) error
}
Transaction provides an interface to modify the LDAP entries in the store.