mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Adding interface methods to logical.Backend for parity (#2242)
This commit is contained in:
committed by
Jeff Mitchell
parent
01484439db
commit
745df0a88c
@@ -68,6 +68,9 @@ type Backend struct {
|
||||
// to the backend, if required.
|
||||
Clean CleanupFunc
|
||||
|
||||
// Invalidate is called when a keys is modified if required
|
||||
Invalidate InvalidateFunc
|
||||
|
||||
// AuthRenew is the callback to call when a RenewRequest for an
|
||||
// authentication comes in. By default, renewal won't be allowed.
|
||||
// See the built-in AuthRenew helpers in lease.go for common callbacks.
|
||||
@@ -92,6 +95,9 @@ type WALRollbackFunc func(*logical.Request, string, interface{}) error
|
||||
// CleanupFunc is the callback for backend unload.
|
||||
type CleanupFunc func()
|
||||
|
||||
// InvalidateFunc is the callback for backend key invalidation.
|
||||
type InvalidateFunc func(string)
|
||||
|
||||
func (b *Backend) HandleExistenceCheck(req *logical.Request) (checkFound bool, exists bool, err error) {
|
||||
b.once.Do(b.init)
|
||||
|
||||
@@ -218,12 +224,20 @@ func (b *Backend) Setup(config *logical.BackendConfig) (logical.Backend, error)
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// Cleanup is used to release resources and prepare to stop the backend
|
||||
func (b *Backend) Cleanup() {
|
||||
if b.Clean != nil {
|
||||
b.Clean()
|
||||
}
|
||||
}
|
||||
|
||||
// InvalidateKey is used to clear caches and reset internal state on key changes
|
||||
func (b *Backend) InvalidateKey(key string) {
|
||||
if b.Invalidate != nil {
|
||||
b.Invalidate(key)
|
||||
}
|
||||
}
|
||||
|
||||
// Logger can be used to get the logger. If no logger has been set,
|
||||
// the logs will be discarded.
|
||||
func (b *Backend) Logger() log.Logger {
|
||||
|
||||
Reference in New Issue
Block a user