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:
Caleb Doxsey 2022-06-13 09:52:13 -06:00 committed by GitHub
parent 2487e9af20
commit 45a29ea879
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 163 additions and 125 deletions

View file

@ -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) {