-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate component Gov OffChain run on separate application
- Loading branch information
1 parent
a175341
commit 388057f
Showing
79 changed files
with
920 additions
and
249 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
dependencies { | ||
implementation project(":components:common") | ||
implementation project(':components:consumer-common') | ||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
implementation 'org.springframework.boot:spring-boot-starter-webflux' | ||
implementation(libs.cardano.client.lib) | ||
implementation(libs.yaci.store.governance) | ||
implementation(libs.jsonld.java) | ||
|
||
compileOnly(libs.lombok) | ||
annotationProcessor(libs.lombok) | ||
|
||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
pom { | ||
name = 'Ledger Sync Scheduler OffChain' | ||
description = 'Ledger Sync Scheduler OffChain Module' | ||
} | ||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
.../cardanofoundation/ledgersync/govoffchainscheduler/GovOffChainSchedulerConfiguration.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,81 @@ | ||
package org.cardanofoundation.ledgersync.govoffchainscheduler; | ||
|
||
import org.cardanofoundation.ledgersync.govoffchainscheduler.jobs.OffChainDataScheduler; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import org.cardanofoundation.ledgersync.govoffchainscheduler.service.OffChainPersistService; | ||
import org.cardanofoundation.ledgersync.govoffchainscheduler.service.OffChainRetryDataErrorService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.autoconfigure.domain.EntityScan; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
|
||
@ConditionalOnProperty( | ||
prefix = "ledger-sync.scheduler", | ||
name = "enabled", | ||
havingValue = "true", | ||
matchIfMissing = true | ||
) | ||
@Configuration | ||
@EnableConfigurationProperties(GovOffChainSchedulerProperties.class) | ||
@ComponentScan(basePackages = {"org.cardanofoundation.ledgersync.govoffchainscheduler"}) | ||
@EnableJpaRepositories(basePackages = {"org.cardanofoundation.ledgersync.govoffchainscheduler"}) | ||
@EntityScan(basePackages = {"org.cardanofoundation.ledgersync.govoffchainscheduler", | ||
"com.bloxbean.cardano.yaci.store.core", | ||
"com.bloxbean.cardano.yaci.store.governance"}) | ||
@EnableTransactionManagement | ||
@EnableScheduling | ||
@EnableAsync | ||
@Slf4j | ||
public class GovOffChainSchedulerConfiguration { | ||
|
||
@Autowired | ||
GovOffChainSchedulerProperties properties; | ||
|
||
// @Bean | ||
// public PoolOfflineDataScheduler poolOfflineDataScheduler(PoolOfflineDataStoringService poolOfflineDataStoringService, | ||
// PoolOfflineDataFetchingService poolOfflineDataFetchingService, | ||
// PoolOfflineDataProperties poolOfflineDataProperties) { | ||
// log.info("<<< Enable PoolOfflineDataScheduler >>>"); | ||
// log.info("PoolOfflineDataScheduler: fixed delay time {} sec", poolOfflineDataProperties.getFixedDelay()); | ||
// return new PoolOfflineDataScheduler(poolOfflineDataStoringService, poolOfflineDataFetchingService, poolOfflineDataProperties); | ||
// } | ||
|
||
@Bean | ||
public OffChainDataScheduler offChainVotingDataScheduler( | ||
OffChainPersistService offChainPersistService, | ||
OffChainRetryDataErrorService offChainDataFetchingErrorService, | ||
OffChainDataProperties offChainDataProperties) { | ||
log.info("<<< Enable OffChainDataScheduler >>>"); | ||
log.info("OffChainDataScheduler: fixed delay time {} sec", offChainDataProperties.getFixedDelay()); | ||
return new OffChainDataScheduler(offChainPersistService, offChainDataFetchingErrorService, offChainDataProperties); | ||
} | ||
|
||
// @Bean | ||
// PoolOfflineDataProperties poolOfflineDataProperties() { | ||
// PoolOfflineDataProperties poolOfflineDataProperties = new PoolOfflineDataProperties(); | ||
// poolOfflineDataProperties.setFixedDelay(properties.getPoolOfflineData().getFixedDelay()); | ||
// poolOfflineDataProperties.setInitialDelay(properties.getPoolOfflineData().getInitialDelay()); | ||
// return poolOfflineDataProperties; | ||
// } | ||
|
||
@Bean | ||
OffChainDataProperties offChainDataProperties() { | ||
OffChainDataProperties offChainDataProperties = new OffChainDataProperties(); | ||
offChainDataProperties.setFixedDelay(properties.getOffChainData().getFixedDelay()); | ||
offChainDataProperties.setInitialDelay(properties.getOffChainData().getInitialDelay()); | ||
offChainDataProperties.setFixedDelayFetchError(properties.getOffChainData().getFixedDelayFetchError()); | ||
offChainDataProperties.setInitialDelayFetchError(properties.getOffChainData().getInitialDelayFetchError()); | ||
offChainDataProperties.setRetryCount(properties.getOffChainData().getRetryCount()); | ||
return offChainDataProperties; | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...org/cardanofoundation/ledgersync/govoffchainscheduler/GovOffChainSchedulerProperties.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,41 @@ | ||
package org.cardanofoundation.ledgersync.govoffchainscheduler; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@Getter | ||
@Setter | ||
@ConfigurationProperties(prefix = "ledger-sync.scheduler", ignoreUnknownFields = true) | ||
public class GovOffChainSchedulerProperties { | ||
private boolean enabled = true; | ||
private PoolOfflineData poolOfflineData = new PoolOfflineData(); | ||
private OffChainData offChainData = new OffChainData(); | ||
private AsyncConfig asyncConfig = new AsyncConfig(); | ||
|
||
@Getter | ||
@Setter | ||
public static final class PoolOfflineData { | ||
private long fixedDelay = 172800L; | ||
private long initialDelay = 20000L; | ||
} | ||
|
||
@Getter | ||
@Setter | ||
public static final class OffChainData { | ||
private long fixedDelay = 300000L; | ||
private long initialDelay = 20000L; | ||
private long fixedDelayFetchError = 2000000L; | ||
private long initialDelayFetchError = 2000000L; | ||
private int retryCount = 10; | ||
} | ||
|
||
@Getter | ||
@Setter | ||
public static final class AsyncConfig { | ||
private int core = 10; | ||
private int max = 12; | ||
private String name = "Scheduler-Executorxx-"; | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...ync/scheduler/OffChainDataProperties.java → ...hainscheduler/OffChainDataProperties.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
10 changes: 5 additions & 5 deletions
10
...sync/scheduler/config/ExecutorConfig.java → ...chainscheduler/config/ExecutorConfig.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
8 changes: 8 additions & 0 deletions
8
...ain/java/org/cardanofoundation/ledgersync/govoffchainscheduler/constant/JobConstants.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,8 @@ | ||
// package org.cardanofoundation.ledgersync.scheduler.constant; | ||
|
||
// public final class JobConstants { | ||
// private JobConstants() {} | ||
|
||
// public static final int DEFAULT_BATCH = 20; | ||
// public static final char END_LINE = '\n'; | ||
// } |
2 changes: 1 addition & 1 deletion
2
...rsync/scheduler/dto/anchor/AnchorDTO.java → ...fchainscheduler/dto/anchor/AnchorDTO.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
2 changes: 1 addition & 1 deletion
2
...to/anchor/CommitteeDeregistrationDTO.java → ...to/anchor/CommitteeDeregistrationDTO.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
2 changes: 1 addition & 1 deletion
2
...ler/dto/anchor/ConstitutionAnchorDTO.java → ...ler/dto/anchor/ConstitutionAnchorDTO.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
2 changes: 1 addition & 1 deletion
2
...duler/dto/anchor/DRepRegistrationDTO.java → ...duler/dto/anchor/DRepRegistrationDTO.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
2 changes: 1 addition & 1 deletion
2
...nc/scheduler/dto/anchor/GovAnchorDTO.java → ...ainscheduler/dto/anchor/GovAnchorDTO.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
2 changes: 1 addition & 1 deletion
2
...duler/dto/anchor/VotingDataAnchorDTO.java → ...duler/dto/anchor/VotingDataAnchorDTO.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
2 changes: 1 addition & 1 deletion
2
...OffChainCommitteeDeregFetchResultDTO.java → ...OffChainCommitteeDeregFetchResultDTO.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
2 changes: 1 addition & 1 deletion
2
...n/OffChainConstitutionFetchResultDTO.java → ...n/OffChainConstitutionFetchResultDTO.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
2 changes: 1 addition & 1 deletion
2
...fChainDRepRegistrationFetchResultDTO.java → ...fChainDRepRegistrationFetchResultDTO.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
2 changes: 1 addition & 1 deletion
2
.../dto/offchain/OffChainFetchResultDTO.java → .../dto/offchain/OffChainFetchResultDTO.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
2 changes: 1 addition & 1 deletion
2
...o/offchain/OffChainGovFetchResultDTO.java → ...o/offchain/OffChainGovFetchResultDTO.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
2 changes: 1 addition & 1 deletion
2
...ffchain/OffChainVotingFetchResultDTO.java → ...ffchain/OffChainVotingFetchResultDTO.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
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
9 changes: 9 additions & 0 deletions
9
...g/cardanofoundation/ledgersync/govoffchainscheduler/projection/PoolHashUrlProjection.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,9 @@ | ||
// package org.cardanofoundation.ledgersync.scheduler.projection; | ||
|
||
// public interface PoolHashUrlProjection { | ||
// Long getPoolId(); | ||
|
||
// String getUrl(); | ||
|
||
// Long getMetadataId(); | ||
// } |
2 changes: 1 addition & 1 deletion
2
...duler/service/OffChainPersistService.java → ...duler/service/OffChainPersistService.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
2 changes: 1 addition & 1 deletion
2
...ervice/OffChainRetryDataErrorService.java → ...ervice/OffChainRetryDataErrorService.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
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
6 changes: 3 additions & 3 deletions
6
...in/OffChainProcessPersistDataService.java → ...in/OffChainProcessPersistDataService.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
7 changes: 7 additions & 0 deletions
7
...ion/ledgersync/govoffchainscheduler/service/offchain/OffChainProcessRetryDataService.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,7 @@ | ||
package org.cardanofoundation.ledgersync.govoffchainscheduler.service.offchain; | ||
|
||
|
||
public interface OffChainProcessRetryDataService { | ||
void process(); | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...vice/offchain/OffChainStoringService.java → ...vice/offchain/OffChainStoringService.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
Oops, something went wrong.