-
Notifications
You must be signed in to change notification settings - Fork 1.1k
7311: Add feature toggle for enabling use of the peertask system where available #7633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jframe
merged 21 commits into
besu-eth:main
from
Matilda-Clerke:7311-add-cli-feature-toggle-for-peertask-system
Sep 24, 2024
Merged
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4c64dbe
7311: Add feature toggle for enabling use of the peertask system wher…
Matilda-Clerke 7a94fe2
7311: Remove log used for testing, apply spotless
Matilda-Clerke ace5dd1
7311: Add private constructor to PeerTaskFeatureToggle to prevent ins…
Matilda-Clerke 52d440a
7311: Switch to logging a warning instead of throwing an exception wh…
Matilda-Clerke f392a0f
7311: Update javadoc to match previous commit
Matilda-Clerke 2fb2690
7311: spotless
Matilda-Clerke f14aaeb
7311: Fix broken BesuCommandTest
Matilda-Clerke f2500dd
7311: Move PeerTaskFeatureToggle to more appropriate location
Matilda-Clerke 33b810b
7311: add X prefix to peertask-system-enabled
Matilda-Clerke 15b6bdf
7311: Move --Xpeertask-system-enabled out of BesuCommand and make hidden
Matilda-Clerke e3fbc6c
7311: spotless
Matilda-Clerke 5e8b750
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
macfarla bc11e0c
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke 513b74f
7311: Move isPeerTaskSystemEnabled to SynchronizerOptions
Matilda-Clerke 6b86919
Merge remote-tracking branch 'origin/7311-add-cli-feature-toggle-for-…
Matilda-Clerke 2364ed5
7311: Fix javadoc issue
Matilda-Clerke 98aefcd
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke 6e734f9
7311: Remove PeerTaskFeatureToggle in favor of including isPeerTaskSy…
Matilda-Clerke 42ca85b
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke 8dedc79
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke fee09c3
Merge branch 'main' into 7311-add-cli-feature-toggle-for-peertask-system
Matilda-Clerke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
59 changes: 59 additions & 0 deletions
59
...c/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/PeerTaskFeatureToggle.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Copyright contributors to Hyperledger Besu. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations under the License. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package org.hyperledger.besu.ethereum.eth.manager.peertask; | ||
|
|
||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| /** | ||
| * Temporary class to allow easy access to the PeerTask feature toggle. This class can be removed | ||
| * once we've properly tested the PeerTask system and want to enable it permanently | ||
| */ | ||
| public class PeerTaskFeatureToggle { | ||
|
Matilda-Clerke marked this conversation as resolved.
Outdated
|
||
| private static final Logger LOGGER = LoggerFactory.getLogger(PeerTaskFeatureToggle.class); | ||
| private static Boolean USE_PEER_TASK_SYSTEM = null; | ||
|
|
||
| /** | ||
| * Initialize the PeerTaskFeatureToggle with the supplied usePeerTaskSystem Boolean. | ||
| * PeerTaskFeatureToggle may only be initialized once! | ||
| * | ||
| * @param usePeerTaskSystem Boolean indicating whether or not the PeerTask system should be used | ||
| */ | ||
| public static void initialize(final Boolean usePeerTaskSystem) { | ||
| if (USE_PEER_TASK_SYSTEM != null) { | ||
| LOGGER.warn( | ||
| "PeerTaskFeatureToggle has already been initialized, and cannot be initialized again"); | ||
| } else { | ||
| USE_PEER_TASK_SYSTEM = usePeerTaskSystem; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Indicates whether or not to use the PeerTask system. PeerTaskFeatureToggle must have been | ||
| * initialized before this method can be called! | ||
| * | ||
| * @return whether or not to use the PeerTask system | ||
| * @throws IllegalStateException if the PeerTaskFeatureToggle has not been initialized | ||
| */ | ||
| public static Boolean usePeerTaskSystem() { | ||
| if (USE_PEER_TASK_SYSTEM == null) { | ||
| throw new IllegalStateException( | ||
| "PeerTaskFeatureToggle has not been initialized, but getUsePeerTaskSystem() has been called"); | ||
| } | ||
| return USE_PEER_TASK_SYSTEM; | ||
| } | ||
|
|
||
| private PeerTaskFeatureToggle() {} | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.