mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
52 lines
1.5 KiB
Go
52 lines
1.5 KiB
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"google.golang.org/protobuf/types/known/anypb"
|
|
|
|
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
|
)
|
|
|
|
type mockBackend struct {
|
|
put func(ctx context.Context, id string, data *anypb.Any) error
|
|
get func(ctx context.Context, id string) (*databroker.Record, error)
|
|
getAll func(ctx context.Context) ([]*databroker.Record, error)
|
|
list func(ctx context.Context, sinceVersion string) ([]*databroker.Record, error)
|
|
delete func(ctx context.Context, id string) error
|
|
clearDeleted func(ctx context.Context, cutoff time.Time)
|
|
watch func(ctx context.Context) <-chan struct{}
|
|
}
|
|
|
|
func (m *mockBackend) Close() error {
|
|
return nil
|
|
}
|
|
|
|
func (m *mockBackend) Put(ctx context.Context, id string, data *anypb.Any) error {
|
|
return m.put(ctx, id, data)
|
|
}
|
|
|
|
func (m *mockBackend) Get(ctx context.Context, id string) (*databroker.Record, error) {
|
|
return m.get(ctx, id)
|
|
}
|
|
|
|
func (m *mockBackend) GetAll(ctx context.Context) ([]*databroker.Record, error) {
|
|
return m.getAll(ctx)
|
|
}
|
|
|
|
func (m *mockBackend) List(ctx context.Context, sinceVersion string) ([]*databroker.Record, error) {
|
|
return m.list(ctx, sinceVersion)
|
|
}
|
|
|
|
func (m *mockBackend) Delete(ctx context.Context, id string) error {
|
|
return m.delete(ctx, id)
|
|
}
|
|
|
|
func (m *mockBackend) ClearDeleted(ctx context.Context, cutoff time.Time) {
|
|
m.clearDeleted(ctx, cutoff)
|
|
}
|
|
|
|
func (m *mockBackend) Watch(ctx context.Context) <-chan struct{} {
|
|
return m.watch(ctx)
|
|
}
|