feature/includeOnly config on network node#33
Draft
Conversation
The "includeOnly" field has been added to the core configuration and schema. This is an optional array that takes in glob-like patterns specifying the streams that should be tracked by the node. It's used as a filter; if the list is empty, all streams fetched from the contract will be tracked.
The update introduces glob-based stream filtering in the `LogStoreNetworkConfig` and `LogStoreNetworkPlugin`. This was achieved by adding 'micromatch' to the dependencies and creating a utility function 'globsMatch' that checks if a string matches any provided glob patterns. This function is now used to filter streams based on the newly added 'includeOnly' option in the plugins.
Refactored the filter logic for stream inclusion from the streamFilter() function to a newly introduced isStreamIncluded() function, improving code reusability. In addition, we introduced the shouldPublishQueryResponseFn() function in order to decide whether the query response should be published if the node opts to not participate in the propagation of the query response.
The method validateUserQueryAccess has been changed to validateQueryRequest, now taking a Request object as parameter. This allows more comprehensive validation such as checking if a stream is included in the network configuration. Error codes have also been added to the response, providing richer error handling capabilities.
Added a periodic check to ensure that the node configuration doesn't include specific streams while having an HTTP server enabled. This feature helps in generating meaningful alerts as these configurations might produce undesired 404 responses from clients. The check is implemented using a new 'createIncompatibleNodeUrlLogger' utility. The logger is subscribed in the LogStoreNetworkPlugin's start method and unsubscribed in its stop method.
The commit introduces utilities needed for effective management of 'logStoreNode' - start, stop, setup, and tear down of nodes. There's also enhancement on the utilities for account setup and cleanup. Alongside the utility scripts, a new integration test was added to verify if queries from a partially included stream are handled correctly by the 'logStoreNode'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.