-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fallen behind detection (#11480)
Signed-off-by: Cody Littley <[email protected]>
- Loading branch information
1 parent
e54e5c3
commit ec95616
Showing
33 changed files
with
1,161 additions
and
1,111 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
71 changes: 71 additions & 0 deletions
71
...tform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/ReservedEventWindow.java
This file contains 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,71 @@ | ||
/* | ||
* Copyright (C) 2024 Hedera Hashgraph, LLC | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.swirlds.platform.gossip.shadowgraph; | ||
|
||
import com.swirlds.platform.consensus.NonAncientEventWindow; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import java.util.Objects; | ||
|
||
/** | ||
* An event window that has been reserved in the shadowgraph. While this reservation is held, the shadowgraph will not | ||
* unlink any events that are non-expired with respect to the reserved window. | ||
*/ | ||
public class ReservedEventWindow implements AutoCloseable { | ||
private final NonAncientEventWindow eventWindow; | ||
private final ShadowgraphReservation shadowgraphReservation; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param eventWindow the event window | ||
* @param shadowgraphReservation the shadowgraph reservation | ||
*/ | ||
public ReservedEventWindow( | ||
@NonNull final NonAncientEventWindow eventWindow, | ||
@NonNull final ShadowgraphReservation shadowgraphReservation) { | ||
this.eventWindow = Objects.requireNonNull(eventWindow); | ||
this.shadowgraphReservation = Objects.requireNonNull(shadowgraphReservation); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public void close() { | ||
shadowgraphReservation.close(); | ||
} | ||
|
||
/** | ||
* Get the reserved event window. No events will be unlinked that are non-expired with respect to this window, as | ||
* long as this reservation is held. | ||
* | ||
* @return the reserved event window | ||
*/ | ||
@NonNull | ||
public NonAncientEventWindow getEventWindow() { | ||
return eventWindow; | ||
} | ||
|
||
/** | ||
* Get the number of reservations in the underlying shadowgraph reservation. Exposed for unit tests. | ||
* | ||
* @return the number of reservations | ||
*/ | ||
public long getReservationCount() { | ||
return shadowgraphReservation.getReservationCount(); | ||
} | ||
} |
Oops, something went wrong.