Skip to content

Commit adf9713

Browse files
authored
feat: Automate scheduler construction for the event deduplicator (#12527)
Signed-off-by: Cody Littley <[email protected]>
1 parent 6e6d891 commit adf9713

File tree

4 files changed

+8
-21
lines changed

4 files changed

+8
-21
lines changed

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/PlatformSchedulers.java

+2-11
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.swirlds.platform.components.ConsensusEngine;
3131
import com.swirlds.platform.event.GossipEvent;
3232
import com.swirlds.platform.event.creation.EventCreationManager;
33-
import com.swirlds.platform.event.deduplication.EventDeduplicator;
3433
import com.swirlds.platform.event.hashing.EventHasher;
3534
import com.swirlds.platform.event.linking.InOrderLinker;
3635
import com.swirlds.platform.event.orphan.OrphanBuffer;
@@ -61,10 +60,11 @@
6160

6261
/**
6362
* The {@link TaskScheduler}s used by the platform.
63+
* <p>
64+
* This class is being phased out. Do not add additional schedulers to this class!
6465
*
6566
* @param eventHasherScheduler the scheduler for the event hasher
6667
* @param postHashCollectorScheduler the scheduler for the post hash collector
67-
* @param eventDeduplicatorScheduler the scheduler for the event deduplicator
6868
* @param eventSignatureValidatorScheduler the scheduler for the event signature validator
6969
* @param orphanBufferScheduler the scheduler for the orphan buffer
7070
* @param inOrderLinkerScheduler the scheduler for the in-order linker
@@ -90,7 +90,6 @@
9090
public record PlatformSchedulers(
9191
@NonNull TaskScheduler<GossipEvent> eventHasherScheduler,
9292
@NonNull TaskScheduler<GossipEvent> postHashCollectorScheduler,
93-
@NonNull TaskScheduler<GossipEvent> eventDeduplicatorScheduler,
9493
@NonNull TaskScheduler<GossipEvent> eventSignatureValidatorScheduler,
9594
@NonNull TaskScheduler<List<GossipEvent>> orphanBufferScheduler,
9695
@NonNull TaskScheduler<EventImpl> inOrderLinkerScheduler,
@@ -148,14 +147,6 @@ public static PlatformSchedulers create(
148147
.withUnhandledTaskCapacity(UNLIMITED_CAPACITY)
149148
.build()
150149
.cast(),
151-
model.schedulerBuilder("eventDeduplicator")
152-
.withType(config.eventDeduplicatorSchedulerType())
153-
.withUnhandledTaskCapacity(config.eventDeduplicatorUnhandledCapacity())
154-
.withFlushingEnabled(true)
155-
.withUnhandledTaskMetricEnabled(true)
156-
.withHyperlink(platformCoreHyperlink(EventDeduplicator.class))
157-
.build()
158-
.cast(),
159150
model.schedulerBuilder("eventSignatureValidator")
160151
.withType(config.eventSignatureValidatorSchedulerType())
161152
.withUnhandledTaskCapacity(config.eventSignatureValidatorUnhandledCapacity())

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/PlatformSchedulersConfig.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@
3535
* negative number.
3636
* @param eventHasherUnhandledCapacity number of unhandled tasks allowed in the event hasher
3737
* scheduler
38-
* @param internalEventValidator configuration for the internal event validator
39-
* scheduler
40-
* @param eventDeduplicatorSchedulerType the event deduplicator scheduler type
41-
* @param eventDeduplicatorUnhandledCapacity number of unhandled tasks allowed in the event deduplicator
42-
* scheduler
38+
* @param internalEventValidator configuration for the internal event validator scheduler
39+
* @param eventDeduplicator configuration for the event deduplicator scheduler
4340
* @param eventSignatureValidatorSchedulerType the event signature validator scheduler type
4441
* @param eventSignatureValidatorUnhandledCapacity number of unhandled tasks allowed in the event signature
4542
* validator scheduler
@@ -98,8 +95,8 @@ public record PlatformSchedulersConfig(
9895
@ConfigProperty(defaultValue = "500") int eventHasherUnhandledCapacity,
9996
@ConfigProperty(defaultValue = "SEQUENTIAL CAPACITY(500) FLUSHABLE UNHANDLED_TASK_METRIC")
10097
TaskSchedulerConfiguration internalEventValidator,
101-
@ConfigProperty(defaultValue = "SEQUENTIAL") TaskSchedulerType eventDeduplicatorSchedulerType,
102-
@ConfigProperty(defaultValue = "500") int eventDeduplicatorUnhandledCapacity,
98+
@ConfigProperty(defaultValue = "SEQUENTIAL CAPACITY(500) FLUSHABLE UNHANDLED_TASK_METRIC")
99+
TaskSchedulerConfiguration eventDeduplicator,
103100
@ConfigProperty(defaultValue = "SEQUENTIAL") TaskSchedulerType eventSignatureValidatorSchedulerType,
104101
@ConfigProperty(defaultValue = "500") int eventSignatureValidatorUnhandledCapacity,
105102
@ConfigProperty(defaultValue = "SEQUENTIAL") TaskSchedulerType orphanBufferSchedulerType,

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/PlatformWiring.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ public PlatformWiring(
218218
new PassThroughWiring<>(model, "GossipEvent", schedulers.postHashCollectorScheduler());
219219
internalEventValidatorWiring =
220220
new ComponentWiring<>(model, InternalEventValidator.class, config.internalEventValidator());
221-
eventDeduplicatorWiring =
222-
new ComponentWiring<>(model, EventDeduplicator.class, schedulers.eventDeduplicatorScheduler());
221+
eventDeduplicatorWiring = new ComponentWiring<>(model, EventDeduplicator.class, config.eventDeduplicator());
223222
eventSignatureValidatorWiring = new ComponentWiring<>(
224223
model, EventSignatureValidator.class, schedulers.eventSignatureValidatorScheduler());
225224
orphanBufferWiring = OrphanBufferWiring.create(schedulers.orphanBufferScheduler());

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/wiring/generate-platform-diagram.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pcli diagram \
2727
-s 'toNotification:StateWriteToDiskCompleteNotification:📦' \
2828
-s 'latestCompleteStateNotifier:CompleteStateNotificationWithCleanup:💢' \
2929
-s 'orphanBufferSplitter:preconsensus signatures:🔰' \
30-
-g 'Event Validation:InternalEventValidator,eventDeduplicator,eventSignatureValidator' \
30+
-g 'Event Validation:InternalEventValidator,EventDeduplicator,eventSignatureValidator' \
3131
-g 'Event Hashing:eventHasher,postHashCollector' \
3232
-g 'Orphan Buffer:orphanBuffer,orphanBufferSplitter' \
3333
-g 'Consensus Engine:consensusEngine,consensusEngineSplitter,eventWindowManager,getKeystoneEventSequenceNumber' \

0 commit comments

Comments
 (0)