mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-08 04:18:13 +02:00
databroker: add list types method
This commit is contained in:
parent
7a405abea1
commit
2eb24fd42a
13 changed files with 494 additions and 232 deletions
|
@ -4,12 +4,14 @@ package inmemory
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/google/btree"
|
||||
"github.com/rs/zerolog"
|
||||
"golang.org/x/exp/maps"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
|
||||
|
@ -186,6 +188,16 @@ func (backend *Backend) Lease(_ context.Context, leaseName, leaseID string, ttl
|
|||
return true, nil
|
||||
}
|
||||
|
||||
// ListTypes lists the record types.
|
||||
func (backend *Backend) ListTypes(ctx context.Context) ([]string, error) {
|
||||
backend.mu.Lock()
|
||||
keys := maps.Keys(backend.lookup)
|
||||
backend.mu.Unlock()
|
||||
|
||||
sort.Strings(keys)
|
||||
return keys, nil
|
||||
}
|
||||
|
||||
// Put puts a record into the in-memory store.
|
||||
func (backend *Backend) Put(ctx context.Context, records []*databroker.Record) (serverVersion uint64, err error) {
|
||||
backend.mu.Lock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue