mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-15 01:57:45 +02:00
databroker: add support for syncing by type (#3412)
* databroker: add support for syncing by type * add type url, fix query
This commit is contained in:
parent
2487e9af20
commit
45a29ea879
17 changed files with 163 additions and 125 deletions
|
@ -82,6 +82,7 @@ const watchPollInterval = 30 * time.Second
|
|||
|
||||
type changedRecordStream struct {
|
||||
backend *Backend
|
||||
recordType string
|
||||
recordVersion uint64
|
||||
|
||||
ctx context.Context
|
||||
|
@ -95,10 +96,12 @@ type changedRecordStream struct {
|
|||
func newChangedRecordStream(
|
||||
ctx context.Context,
|
||||
backend *Backend,
|
||||
recordType string,
|
||||
recordVersion uint64,
|
||||
) storage.RecordStream {
|
||||
stream := &changedRecordStream{
|
||||
backend: backend,
|
||||
recordType: recordType,
|
||||
recordVersion: recordVersion,
|
||||
ticker: time.NewTicker(watchPollInterval),
|
||||
changed: backend.onChange.Bind(),
|
||||
|
@ -129,6 +132,7 @@ func (stream *changedRecordStream) Next(block bool) bool {
|
|||
stream.record, stream.err = getNextChangedRecord(
|
||||
stream.ctx,
|
||||
pool,
|
||||
stream.recordType,
|
||||
stream.recordVersion,
|
||||
)
|
||||
if isNotFound(stream.err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue