mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-04 11:52:53 +02:00
databroker: add support for putting multiple records (#3291)
* databroker: add support for putting multiple records * add OptimumPutRequestsFromRecords function * replace GetAll with SyncLatest * fix stream when there are no records
This commit is contained in:
parent
343fa43ed4
commit
f73c5c615f
28 changed files with 790 additions and 660 deletions
|
@ -13,27 +13,22 @@ import (
|
|||
|
||||
type mockBackend struct {
|
||||
Backend
|
||||
put func(ctx context.Context, record *databroker.Record) (uint64, error)
|
||||
get func(ctx context.Context, recordType, id string) (*databroker.Record, error)
|
||||
getAll func(ctx context.Context) ([]*databroker.Record, *databroker.Versions, error)
|
||||
put func(ctx context.Context, records []*databroker.Record) (uint64, error)
|
||||
get func(ctx context.Context, recordType, id string) (*databroker.Record, error)
|
||||
}
|
||||
|
||||
func (m *mockBackend) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *mockBackend) Put(ctx context.Context, record *databroker.Record) (uint64, error) {
|
||||
return m.put(ctx, record)
|
||||
func (m *mockBackend) Put(ctx context.Context, records []*databroker.Record) (uint64, error) {
|
||||
return m.put(ctx, records)
|
||||
}
|
||||
|
||||
func (m *mockBackend) Get(ctx context.Context, recordType, id string) (*databroker.Record, error) {
|
||||
return m.get(ctx, recordType, id)
|
||||
}
|
||||
|
||||
func (m *mockBackend) GetAll(ctx context.Context) ([]*databroker.Record, *databroker.Versions, error) {
|
||||
return m.getAll(ctx)
|
||||
}
|
||||
|
||||
func TestMatchAny(t *testing.T) {
|
||||
u := &user.User{Id: "id", Name: "name", Email: "email"}
|
||||
data := protoutil.NewAny(u)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue