mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 11:08:10 +00:00
Add context to storage backends and wire it through a lot of places (#3817)
This commit is contained in:
committed by
Jeff Mitchell
parent
2864fbd697
commit
8142b42d95
@@ -1,6 +1,7 @@
|
||||
package postgresql
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strconv"
|
||||
@@ -125,7 +126,7 @@ func (m *PostgreSQLBackend) splitKey(fullPath string) (string, string, string) {
|
||||
}
|
||||
|
||||
// Put is used to insert or update an entry.
|
||||
func (m *PostgreSQLBackend) Put(entry *physical.Entry) error {
|
||||
func (m *PostgreSQLBackend) Put(ctx context.Context, entry *physical.Entry) error {
|
||||
defer metrics.MeasureSince([]string{"postgres", "put"}, time.Now())
|
||||
|
||||
m.permitPool.Acquire()
|
||||
@@ -141,7 +142,7 @@ func (m *PostgreSQLBackend) Put(entry *physical.Entry) error {
|
||||
}
|
||||
|
||||
// Get is used to fetch and entry.
|
||||
func (m *PostgreSQLBackend) Get(fullPath string) (*physical.Entry, error) {
|
||||
func (m *PostgreSQLBackend) Get(ctx context.Context, fullPath string) (*physical.Entry, error) {
|
||||
defer metrics.MeasureSince([]string{"postgres", "get"}, time.Now())
|
||||
|
||||
m.permitPool.Acquire()
|
||||
@@ -166,7 +167,7 @@ func (m *PostgreSQLBackend) Get(fullPath string) (*physical.Entry, error) {
|
||||
}
|
||||
|
||||
// Delete is used to permanently delete an entry
|
||||
func (m *PostgreSQLBackend) Delete(fullPath string) error {
|
||||
func (m *PostgreSQLBackend) Delete(ctx context.Context, fullPath string) error {
|
||||
defer metrics.MeasureSince([]string{"postgres", "delete"}, time.Now())
|
||||
|
||||
m.permitPool.Acquire()
|
||||
@@ -183,7 +184,7 @@ func (m *PostgreSQLBackend) Delete(fullPath string) error {
|
||||
|
||||
// List is used to list all the keys under a given
|
||||
// prefix, up to the next prefix.
|
||||
func (m *PostgreSQLBackend) List(prefix string) ([]string, error) {
|
||||
func (m *PostgreSQLBackend) List(ctx context.Context, prefix string) ([]string, error) {
|
||||
defer metrics.MeasureSince([]string{"postgres", "list"}, time.Now())
|
||||
|
||||
m.permitPool.Acquire()
|
||||
|
||||
Reference in New Issue
Block a user