* LastImportTime for resource.
* Make StorageBackendImpl implement GetResourceLastImportTimes
* More missing implementations of GetResourceLastImportTimes
* Fix import.
* Skip TestGetResourceLastImportTime in TestBadgerKVStorageBackend.
* Implement GetResourceLastImportTimes by mockStorageBackend
* Bump test tolerance.
* Fix postgres query and timezone.
* Fix postgres query and timezone.
* Make linter happy.
* Don't use transaction in ListModifiedSince.
To guarantee that we don't include events with RV > LatestRV, we include the check in SQL query instead.
* Fix integration test by converting SQL comments into template comments.
* WIP added ListSinceModified to StorageBackend interface
* fix compile time check
* Fix method name
* Fix naming
* fix the rest of the ListSinceModified names
* Uses resource key without name field
* get latest rv from resource_version. Update test.
* adds moar tests
* adds method stub for ListModifiedSince to other StorageBackend implementations
* adds dummy impl to noop storage backend for ListModifiedSince
* skip tests for badger kv backend for now
* fixes tests and adds badgerkv impl for ListModifiedSince
* add badger kv impl
* adds test for new query
* adds test data for new query
* adds ListModifiedSince stub to mockStorageBackend
* uncomment tests
* refactors ListModifiedSince to return an iter.seq2 and handles deduplication. Updates tests. Updates query result sorting.
* remove comments
* remove folder from query (dont need it, yet?)
* regen test queries
* updates test
* updates function comment
* use resourcepb.ResourceKey instead of ModifiedResourceKey
* wrap seq in single transaction. Rollback transaction after 30s if iterator never used. Only track last seen event. Formatting.
* skip TestListModifiedSince for kv backend
* use WatchEvent_Type for action type
* remove redundant fields from order by clause and regen test data for query
* remove redundant fields from order by clause and regen test data for query
* SQLTemplates: Add helper to ensure all templates have a test-case associated
* UnifiedStorage: Add missing sql template test case
* LegacyDashboards: Add sql templates fs to test cases for exhaustiveness check
* RBACStore: Add sql templates fs to test cases for exhaustiveness check
* LegacyIAM: Add missing sql template test cases
* Use epoch with microsecond resolution as RV
* fix backend tests
* Add solution for when the clock goes back
* Add solution for when the clock goes back
* generate mocks
* go lint
* remove comment
* Use Greatest instead of max in msyql and postgres
* update tests
* Update pkg/storage/unified/sql/sqltemplate/dialect_sqlite.go
Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
* cast to bigint
* add additional round trip
* increment the RV using 2 sql round trips instead of 3
* cleanup comments
* cast unix timestamp to integer
* fix postgres query
* remove old increment test data
* remove greatest
* cast unix_timestamp to signed
* Use statement_timestamp instead of clock_timestamp
---------
Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
* Revert "Revert "Unistore : Ensure Watch works in HA mode." (#94097)"
This reverts commit 7c3fc2f261.
* make previous_resource_version nullable
* handle nil case
* Replace Watch with WatchNext
* remove watchset
* fix previous page and closing the channel
* Remove the broadcaster cache to prevent dupplicated events
* add watch bookmark
* add watch bookmark
* cleanup comments
* disable the tests for bookmarks for now
* Ensure we send previosu events
* lint
* re-introduce the cache
* load from cache
* disabling legacy test
* disabling legacy test
* Update pkg/storage/unified/resource/server.go
Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
* Could not read previous events
* add proper migration
* Add previous_resource_version to both history and resource
* First event should have an RV of 2 and not 1
* Test both storage backends
* fix the inital RV for the sql backend
* ensure graceful stop of the stream decoder
* gocyclo
---------
Co-authored-by: Diego Augusto Molina <diegoaugustomolina@gmail.com>
* cleanup dependencies and improve list method
* Improve Resource Server API, remove unnecessary dependencies
* Reduce the API footprint of ResourceDBInterface and its implementation
* Improve LifecycleHooks to use context
* Improve testing
* reduce API size and improve code
* sqltemplate: add DialectForDriver func and improve naming
* improve lifecycle API
* many small fixes after adding more tests