Daniel Nephin
98d6dcbdf8
state: use constants for table checks
2021-03-29 16:38:43 -04:00
Daniel Nephin
bcbdc9cab3
state: pass Query in from caller
...
To reduce the number of arguments
2021-03-29 15:42:30 -04:00
Daniel Nephin
9a3daf3100
state: use constant for tableServices
2021-03-29 15:42:18 -04:00
Daniel Nephin
ec50454fb3
state: move services.ID to new pattern
2021-03-19 14:11:59 -04:00
Daniel Nephin
66632538d8
state: use constants and remove wrapping
...
for GatewayServices table
2021-03-18 12:08:59 -04:00
Daniel Nephin
0b3930272d
state: convert services.node and checks.node indexes
...
Using NodeIdentity to share the indexes with both.
2021-03-16 13:00:31 -04:00
Daniel Nephin
4877183bc6
Merge pull request #9797 from hashicorp/dnephin/state-index-node-id
...
state: convert nodes.ID to the new pattern of functional indexers
2021-03-10 17:34:23 -05:00
Daniel Nephin
94820e67a8
structs: remove EnterpriseMeta.GetNamespace
...
I added this recently without realizing that the method already existed and was named
NamespaceOrEmpty. Replace all calls to GetNamespace with NamespaceOrEmpty or NamespaceOrDefault
as appropriate.
2021-03-09 15:17:26 -05:00
Daniel Nephin
0d3bb68255
state: handle terminating gateway events properly in snapshot
...
Refactored out a function that can be used for both the snapshot and stream of events to translate
an event into an appropriate connect event.
Previously terminating gateway events would have used the wrong key in the snapshot, which would have
caused them to be filtered out later on.
Also removed an unused function, and some commented out code.
2021-03-09 14:00:35 -05:00
Daniel Nephin
38aeb88908
Start to setup enterprise tests for terminating gateway streaming events.
...
Co-Authored-By: Kyle Havlovitz <kylehav@gmail.com>
2021-03-09 14:00:35 -05:00
Daniel Nephin
d0b37f18f0
state: Add support for override of namespace
...
in MatchesKey
also tests for MatchesKey
Co-Authored-By: Kyle Havlovitz <kylehav@gmail.com>
2021-03-09 14:00:35 -05:00
Daniel Nephin
ba59727337
state: update calls to ensureConfigEntryTxn
...
The EnterpriseMeta paramter was removed after this code was written, but before it merged.
Also the table name constant has changed.
2021-03-09 14:00:35 -05:00
Daniel Nephin
15b0d5f62b
state: Add two more tests for connect events with terminating gateways
...
And expand one test case to cover more.
Co-Authored-By: Kyle Havlovitz <kylehav@gmail.com>
2021-03-09 14:00:34 -05:00
Daniel Nephin
abab373b89
state: Include the override key in the sorting of events
...
Co-Authored-By: Kyle Havlovitz <kylehav@gmail.com>
2021-03-09 14:00:34 -05:00
Kyle Havlovitz
f31582624d
state: Add terminating gateway events on updating a config entry
...
Co-Authored-By: Daniel Nephin <dnephin@hashicorp.com>
2021-03-09 14:00:34 -05:00
Daniel Nephin
f42a2ca8a3
state: add first terminating catalog catalog event
...
Health of a terminating gateway instance changes
- Generate an event for creating/destroying this instance of the terminating gateway,
duplicate it for each affected service
Co-Authored-By: Kyle Havlovitz <kylehav@gmail.com>
2021-03-09 14:00:33 -05:00
Daniel Nephin
1184ceff9e
state: convert nodes.ID to new functional pattern
...
In preparation for adding other identifiers to the index.
2021-03-05 12:30:40 -05:00
Daniel Nephin
4a44cfd676
Merge pull request #9188 from hashicorp/dnephin/more-streaming-tests
...
Add more streaming tests
2021-02-26 12:36:55 -05:00
Daniel Nephin
4ef9578a07
Merge pull request #9703 from pierresouchay/streaming_tags_and_case_insensitive
...
Streaming filter tags + case insensitive lookups for Service Names
2021-02-26 12:06:26 -05:00
Daniel Nephin
2cc3282d5d
catalog_events: set the right key for connect snapshots
...
Add a test for catalog_event snapshot on connect topic
2021-02-25 14:30:39 -05:00
Daniel Nephin
e8beda4685
state: Add a test for ServiceHealthSnapshot
2021-02-25 14:08:10 -05:00
Daniel Nephin
c40d063a0e
structs: rename EnterpriseMeta constructor
...
To match the Go convention.
2021-02-16 14:45:43 -05:00
Pierre Souchay
c466b08481
Streaming filter tags + case insensitive lookups for Service Names
...
Will fix:
* https://github.com/hashicorp/consul/issues/9695
* https://github.com/hashicorp/consul/issues/9702
2021-02-04 11:00:51 +01:00
Daniel Nephin
e4a78c977d
stream: document that Payload must be immutable
...
If they are sent to EventPublisher.Publish.
Also document that PayloadEvents is expected to come from a subscription and that it is
not immutable.
2020-11-06 13:00:33 -05:00
Daniel Nephin
4fc073b1f4
stream: rename FilterByKey
2020-11-05 19:21:16 -05:00
Daniel Nephin
d4cd2fa6a8
stream: Add HasReadPermission to Payload
...
Required now that filter is a method on PayloadEvents instead of Event
2020-11-05 19:17:18 -05:00
Daniel Nephin
621f1db766
Merge pull request #9073 from hashicorp/dnephin/backport-streaming-namespaces
...
streaming: backport namespace changes
2020-11-05 14:19:10 -05:00
Daniel Nephin
cd220e5d6c
Merge pull request #9061 from hashicorp/dnephin/event-fields
...
stream: support filtering by namespace
2020-11-05 14:18:35 -05:00
Daniel Nephin
f6b629852f
state: test EventPayloadCheckServiceNode.FilterByKey
...
Also fix a bug in that function when only one of key or namespace were the empty string.
2020-10-30 14:35:57 -04:00
Daniel Nephin
2d0030da39
state: use enterprise meta for creating events
2020-10-30 14:34:04 -04:00
Daniel Nephin
61ce0964a4
stream: remove Event.Key
...
Makes Payload a type with FilterByKey so that Payloads can implement
filtering by key. With this approach we don't need to expose a Namespace
field on Event, and we don't need to invest micro formats or require a
bunch of code to be aware of exactly how the key field is encoded.
2020-10-28 16:48:04 -04:00
Daniel Nephin
eea87e1acf
store: use a ReadDB for snapshots
...
to remove the cyclic dependency between the snapshot handlers and the state.Store
2020-10-28 13:07:42 -04:00
Daniel Nephin
e345c8d8a6
state: use pbsubscribe.Topic for topic values
2020-09-28 18:40:10 -04:00
Daniel Nephin
6e592ec485
state: rename and export EventPayload
...
The subscribe endpoint needs to be able to inspect the payload to filter
events, and convert them into the protobuf types.
Use the protobuf CatalogOp type for the operation field, for now. In the
future if we end up with multiple interfaces we should be able to remove
the protobuf dependency by changing this to an int32 and adding a test
for the mapping between the values.
Make the value of the payload a concrete type instead of interface{}. We
can create other payloads for other event types.
2020-09-28 18:34:30 -04:00
Daniel Nephin
c17a5b0628
state: handle terminating gateways in service health events
2020-09-03 16:58:05 -04:00
Daniel Nephin
b241debee7
state: improve comments in catalog_events.go
...
Co-authored-by: Paul Banks <banks@banksco.de>
2020-09-03 16:58:05 -04:00
Daniel Nephin
870823e8ed
state: use changeType in serviceChanges
...
To be a little more explicit, instead of nil implying an indirect change
2020-09-03 16:58:05 -04:00
Daniel Nephin
68682e7e83
don't over allocate slice
2020-09-03 16:58:04 -04:00
Daniel Nephin
5f52220f53
state: fix a bug in building service health events
...
The nodeCheck slice was being used as the first arg in append, which in some cases will modify the array backing the slice. This would lead to service checks for other services in the wrong event.
Also refactor some things to reduce the arguments to functions.
2020-09-03 16:58:04 -04:00
Daniel Nephin
c61313b78a
state: Remove unused args and return values
...
Also rename some functions to identify them as constructors for events
2020-09-03 16:58:04 -04:00
Daniel Nephin
668b98bcce
state: use an enum for tracking node changes
2020-09-03 16:58:04 -04:00
Daniel Nephin
7c3c627028
state: serviceHealthSnapshot
...
refactored to remove unused return value and remove duplication
2020-09-03 16:58:04 -04:00
Daniel Nephin
fdfe176deb
state: Add Change processor and snapshotter for service health
...
Co-authored-by: Paul Banks <banks@banksco.de>
2020-09-03 16:58:04 -04:00