mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-01 10:22:43 +02:00
databroker: add options for maximum capacity (#2095)
* databroker: add options * implement redis * add trace for enforce options
This commit is contained in:
parent
b3216ae854
commit
636b3d6846
14 changed files with 1085 additions and 419 deletions
|
@ -177,7 +177,7 @@ func (srv *Server) Query(ctx context.Context, req *databroker.QueryRequest) (*da
|
|||
}, nil
|
||||
}
|
||||
|
||||
// Put updates a record in the in-memory list, or adds a new one.
|
||||
// Put updates an existing record or adds a new one.
|
||||
func (srv *Server) Put(ctx context.Context, req *databroker.PutRequest) (*databroker.PutResponse, error) {
|
||||
_, span := trace.StartSpan(ctx, "databroker.grpc.Put")
|
||||
defer span.End()
|
||||
|
@ -202,6 +202,28 @@ func (srv *Server) Put(ctx context.Context, req *databroker.PutRequest) (*databr
|
|||
}, nil
|
||||
}
|
||||
|
||||
// SetOptions sets options for a type in the databroker.
|
||||
func (srv *Server) SetOptions(ctx context.Context, req *databroker.SetOptionsRequest) (*databroker.SetOptionsResponse, error) {
|
||||
_, span := trace.StartSpan(ctx, "databroker.grpc.SetOptions")
|
||||
defer span.End()
|
||||
|
||||
backend, _, err := srv.getBackend()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = backend.SetOptions(ctx, req.GetType(), req.GetOptions())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
options, err := backend.GetOptions(ctx, req.GetType())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &databroker.SetOptionsResponse{
|
||||
Options: options,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Sync streams updates for the given record type.
|
||||
func (srv *Server) Sync(req *databroker.SyncRequest, stream databroker.DataBrokerService_SyncServer) error {
|
||||
_, span := trace.StartSpan(stream.Context(), "databroker.grpc.Sync")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue