Skip to content
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

GraalVM implementation #305

Merged
merged 49 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e736550
chore: Initial graalvm impl
satran004 Jul 4, 2024
867241c
chore: Initial graalvm impl
satran004 Jul 4, 2024
87fae80
Merge branch 'main' into feat/graalvm
satran004 Jul 16, 2024
1bade64
chore: Graalvm changes for utxo-indexer
satran004 Jul 17, 2024
57f2f47
chore: Remove NonNull
satran004 Jul 21, 2024
8d561e4
chore: gc setting
satran004 Jul 21, 2024
483ded6
chore: Merging with main
satran004 Aug 31, 2024
2b3e373
chore: Added metadata
satran004 Sep 5, 2024
44b4b5f
Add more reflection classes
satran004 Sep 8, 2024
7c5779e
chore: Remove handleCommitEvent method to Storage interface and add e…
satran004 Sep 10, 2024
0d70fa5
chore: Remove handleCommitEvent method to Storage interface and add e…
satran004 Sep 10, 2024
c934ab6
chore: Use Yaci Store JsonUtil
satran004 Sep 10, 2024
c06c085
chore: Native image related change
satran004 Sep 11, 2024
b455e55
chore: Reachable metadata changes, gradle change for Spring boot 3.3.0
satran004 Sep 11, 2024
d008adc
Native image related changes
satran004 Sep 19, 2024
9399fec
Merge with develop_0.1.x
satran004 Nov 4, 2024
0659a3c
Remove unused imports and services
satran004 Nov 4, 2024
6607d8f
Delete application.properties
satran004 Nov 8, 2024
19afdf2
Add dynamic libc config
satran004 Nov 10, 2024
b9e8218
chore: change for native image build
satran004 Nov 11, 2024
8db59a8
graalvm build change
satran004 Nov 11, 2024
6e8002d
graalvm build change
satran004 Nov 11, 2024
2627024
graalvm build change
satran004 Nov 11, 2024
20a922f
graalvm build change
satran004 Nov 11, 2024
ba1db9c
graalvm build change
satran004 Nov 11, 2024
9251a3e
graalvm build change
satran004 Nov 11, 2024
0f65f2a
Fix whitespace issues in workflow and gradle properties
satran004 Nov 11, 2024
0c0e922
Enhance Gradle build command with version parameter
satran004 Nov 11, 2024
feec631
Enhance Gradle build command with version parameter
satran004 Nov 11, 2024
bb29a94
Update OS matrix in dev_release_cli workflow
satran004 Nov 11, 2024
7714eec
Add macOS 13 to GitHub Actions CI matrix
satran004 Nov 12, 2024
b83fc0b
Enhance Gradle build command with version parameter
satran004 Nov 12, 2024
8b18da1
Update version and add native release workflow
satran004 Nov 12, 2024
cf619c1
Rename workflow for more accurate description
satran004 Nov 12, 2024
0c03c81
Graalvm static build with musl + windows build (#401)
satran004 Nov 19, 2024
fb690f5
Update gradle.properties version to 0.1.1-graalvm-preview2
satran004 Nov 19, 2024
50c34a3
fix: #399 Add serializer to convert amount from BigIn to String (#404)
satran004 Nov 26, 2024
077bd23
Merge branch 'develop_0.1.x' into feat/graalvm
satran004 Nov 26, 2024
d734886
Blockfrost Block by number/hash api Response Format Mismatch (#405)
satran004 Nov 26, 2024
28da334
fix: #399 Refactor 'amount' handling and add API test for UTxOs (#406)
satran004 Nov 26, 2024
c172959
Asset Transactions endpoint + DB type specific indexing + asset endpo…
satran004 Nov 28, 2024
47332ac
Enable dynamic property for index management.
satran004 Nov 29, 2024
4f55f8d
Fixed paths
satran004 Nov 29, 2024
cb4de3e
Merge with main
satran004 Nov 29, 2024
9cfaeaa
Merge with develop_0.1.x
satran004 Nov 29, 2024
3f3a354
Remove LocalClientProviderManagerCondition class and related code.
satran004 Nov 29, 2024
d99deca
Fixed sql issues
satran004 Nov 29, 2024
9d16606
Fix incorrect entity reference in max epoch query
satran004 Nov 29, 2024
ec5aef9
Add staking POJOs to reflect-config for native image
satran004 Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 112 additions & 7 deletions .github/workflows/dev_release_native.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Build and Upload Yaci Store Zip
name: Dev Build and Upload Yaci Store Zip

on:
workflow_dispatch:

jobs:
buildAndUpload:
buildAndUpload-mostly-static:
strategy:
matrix:
# os: ["ubuntu-20.04", "macos-14"]
os: ["ubuntu-20.04", "macOS", "macos-13"]
profile: ["n2c", ""]
# os: ["ubuntu-20.04", "macos-14"]
os: [ "ubuntu-20.04", "macOS", "macos-13" ]
profile: [ "n2c", "" ]
runs-on: ${{ matrix.os }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -22,15 +22,15 @@ jobs:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.4'
version: '21.0.5'
native-image-job-reports: 'true'
- name: Get Version from gradle.properties
run: |
VERSION=$(grep "version=" gradle.properties | cut -d'=' -f2 | xargs)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Copy CI specific native-image properties
- name: Copy CI specific native-image properties and env setup
if: runner.os == 'Linux'
run: |
echo "os_prefix=linux" >> $GITHUB_ENV
Expand All @@ -55,3 +55,108 @@ jobs:
with:
name: yaci-store-${{ env.VERSION }}-${{ env.os_prefix }}-${{ env.arch }}${{ env.PROFILE_SUFFIX }}
path: ./applications/all/build/output/yaci-store-${{ env.VERSION }}-${{ env.os_prefix }}-${{ env.arch }}${{ env.PROFILE_SUFFIX }}.zip

buildAndUpload-musl:
strategy:
matrix:
# os: ["ubuntu-20.04", "macos-14"]
os: ["ubuntu-20.04"]
profile: ["n2c", ""]
runs-on: ${{ matrix.os }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.5'
native-image-musl: true
native-image-job-reports: 'true'
- name: Get Version from gradle.properties
run: |
VERSION=$(grep "version=" gradle.properties | cut -d'=' -f2 | xargs)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Copy CI specific native-image properties and env setup
if: runner.os == 'Linux'
run: |
echo "os_prefix=linux" >> $GITHUB_ENV
cp applications/all/src/main/resources/META-INF/native-image/yaci-store-all/native-image.properties.musl applications/all/src/main/resources/META-INF/native-image/yaci-store-all/native-image.properties
- name: MacOS specific env
if: runner.os == 'macOS'
run: |
echo "os_prefix=macos" >> $GITHUB_ENV
- name: Set lowercase architecture
run: echo "arch=$(echo ${{ runner.arch }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set Profile Suffix
run: |
if [ -n "${{ matrix.profile }}" ]; then
echo "PROFILE_SUFFIX=-${{ matrix.profile }}" >> $GITHUB_ENV
else
echo "PROFILE_SUFFIX=" >> $GITHUB_ENV
fi
- name: Build with Gradle
run: ./gradlew --no-daemon -i -Pversion=${{ env.VERSION }} -Pprofile=${{ matrix.profile }} clean cliZip
- name: Copy artifacts
run: mv applications/all/build/output/yaci-store-*.zip applications/all/build/output/yaci-store-${{ env.VERSION }}-${{ env.os_prefix }}-musl-${{ env.arch }}${{ env.PROFILE_SUFFIX }}.zip
- uses: actions/upload-artifact@v4
with:
name: yaci-store-${{ env.VERSION }}-${{ env.os_prefix }}-musl-${{ env.arch }}${{ env.PROFILE_SUFFIX }}
path: ./applications/all/build/output/yaci-store-${{ env.VERSION }}-${{ env.os_prefix }}-musl-${{ env.arch }}${{ env.PROFILE_SUFFIX }}.zip

windowBuild:
strategy:
matrix:
profile: ["n2c", ""]
runs-on: windows-latest
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.5'
native-image-job-reports: 'true'
- name: Extract version (Windows)
shell: pwsh
run: |
$VERSION = (Get-Content gradle.properties | Where-Object { $_ -match "^version=" } | ForEach-Object { $_.Split('=')[1].Trim() })
echo "VERSION=$VERSION" >> $env:GITHUB_ENV
- name: Set Profile Suffix
shell: pwsh
run: |
if ("${{ matrix.profile }}" -ne "") {
Add-Content -Path $env:GITHUB_ENV -Value "PROFILE_SUFFIX=-${{ matrix.profile }}"
} else {
Add-Content -Path $env:GITHUB_ENV -Value "PROFILE_SUFFIX="
}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Windows specific env
run: |
echo "os_prefix=win" >> $GITHUB_ENV
copy applications\all\src\main\resources\META-INF\native-image\yaci-store-all\native-image.properties.win applications\all\src\main\resources\META-INF\native-image\yaci-store-all\native-image.properties
- name: Set lowercase architecture
shell: pwsh
run: |
$arch = "${{ runner.arch }}".ToLower()
Add-Content -Path $env:GITHUB_ENV -Value "arch=$arch"
- name: Build with Gradle
run: ./gradlew --no-daemon -i -Pprofile=${{ matrix.profile }} clean cliZip
- name: Copy artifacts
run: mv applications/all/build/output/yaci-store-*.zip applications/all/build/output/yaci-store-${{ env.VERSION }}-windows-${{ env.arch }}${{ env.PROFILE_SUFFIX }}.zip
- uses: actions/upload-artifact@v4
with:
name: yaci-store-${{ env.VERSION }}-windows-${{ env.arch }}${{ env.PROFILE_SUFFIX }}
path: ./applications/all/build/output/yaci-store-${{ env.VERSION }}-windows-${{ env.arch }}${{ env.PROFILE_SUFFIX }}.zip
125 changes: 119 additions & 6 deletions .github/workflows/release_native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ on:
- 'rel-graal-*'

jobs:
buildAndUpload:
buildAndUpload-mostly-static:
strategy:
matrix:
# os: ["ubuntu-20.04", "macos-14"]
os: ["ubuntu-20.04", "macOS", "macos-13"]
profile: ["n2c", ""]
os: [ "ubuntu-20.04", "macOS", "macos-13" ]
profile: [ "n2c", "" ]
runs-on: ${{ matrix.os }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -24,15 +23,15 @@ jobs:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.4'
version: '21.0.5'
native-image-job-reports: 'true'
- name: Get Version from gradle.properties
run: |
VERSION=$(grep "version=" gradle.properties | cut -d'=' -f2 | xargs)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Copy CI specific native-image properties
- name: Copy CI specific native-image properties and env setup
if: runner.os == 'Linux'
run: |
echo "os_prefix=linux" >> $GITHUB_ENV
Expand Down Expand Up @@ -62,3 +61,117 @@ jobs:
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

buildAndUpload-musl:
strategy:
matrix:
os: ["ubuntu-20.04"]
profile: ["n2c", ""]
runs-on: ${{ matrix.os }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.5'
native-image-musl: true
native-image-job-reports: 'true'
- name: Get Version from gradle.properties
run: |
VERSION=$(grep "version=" gradle.properties | cut -d'=' -f2 | xargs)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Copy CI specific native-image properties and env setup
if: runner.os == 'Linux'
run: |
echo "os_prefix=linux" >> $GITHUB_ENV
cp applications/all/src/main/resources/META-INF/native-image/yaci-store-all/native-image.properties.musl applications/all/src/main/resources/META-INF/native-image/yaci-store-all/native-image.properties
- name: MacOS specific env
if: runner.os == 'macOS'
run: |
echo "os_prefix=macos" >> $GITHUB_ENV
- name: Set lowercase architecture
run: echo "arch=$(echo ${{ runner.arch }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set Profile Suffix
run: |
if [ -n "${{ matrix.profile }}" ]; then
echo "PROFILE_SUFFIX=-${{ matrix.profile }}" >> $GITHUB_ENV
else
echo "PROFILE_SUFFIX=" >> $GITHUB_ENV
fi
- name: Build with Gradle
run: ./gradlew --no-daemon -i -Pversion=${{ env.VERSION }} -Pprofile=${{ matrix.profile }} clean cliZip
- name: Copy artifacts
run: mv applications/all/build/output/yaci-store-*.zip applications/all/build/output/yaci-store-${{ env.VERSION }}-${{ env.os_prefix }}-musl-${{ env.arch }}${{ env.PROFILE_SUFFIX }}.zip
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
applications/all/build/output/yaci-store-${{ env.VERSION }}-${{ env.os_prefix }}-musl-${{ env.arch }}${{ env.PROFILE_SUFFIX }}.zip
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

windowBuild:
strategy:
matrix:
profile: ["n2c", ""]
runs-on: windows-latest
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '21.0.5'
native-image-job-reports: 'true'
- name: Extract version (Windows)
shell: pwsh
run: |
$VERSION = (Get-Content gradle.properties | Where-Object { $_ -match "^version=" } | ForEach-Object { $_.Split('=')[1].Trim() })
echo "VERSION=$VERSION" >> $env:GITHUB_ENV
- name: Set Profile Suffix
shell: pwsh
run: |
if ("${{ matrix.profile }}" -ne "") {
Add-Content -Path $env:GITHUB_ENV -Value "PROFILE_SUFFIX=-${{ matrix.profile }}"
} else {
Add-Content -Path $env:GITHUB_ENV -Value "PROFILE_SUFFIX="
}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Windows specific env
run: |
echo "os_prefix=win" >> $GITHUB_ENV
copy applications\all\src\main\resources\META-INF\native-image\yaci-store-all\native-image.properties.win applications\all\src\main\resources\META-INF\native-image\yaci-store-all\native-image.properties
- name: Set lowercase architecture
shell: pwsh
run: |
$arch = "${{ runner.arch }}".ToLower()
Add-Content -Path $env:GITHUB_ENV -Value "arch=$arch"
- name: Build with Gradle
run: ./gradlew --no-daemon -i -Pprofile=${{ matrix.profile }} clean cliZip
- name: Copy artifacts
run: mv applications/all/build/output/yaci-store-*.zip applications/all/build/output/yaci-store-${{ env.VERSION }}-windows-${{ env.arch }}${{ env.PROFILE_SUFFIX }}.zip
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
applications/all/build/output/yaci-store-${{ env.VERSION }}-windows-${{ env.arch }}${{ env.PROFILE_SUFFIX }}.zip
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.bloxbean.cardano.yaci.store.events.internal.CommitEvent;
import com.bloxbean.cardano.yaci.store.events.internal.PreCommitEvent;
import com.bloxbean.cardano.yaci.store.utxo.domain.AddressUtxoEvent;
import jakarta.annotation.PostConstruct;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
Expand Down Expand Up @@ -94,9 +93,10 @@ public AccountBalanceProcessor(AccountBalanceStorage accountBalanceStorage,
this.parallelExecutor = parallelExecutor;
this.transactionManager = transactionManager;
this.metricCollectorService = metricCollectorService;

init();
}

@PostConstruct
void init() {
transactionTemplate = new TransactionTemplate(transactionManager);
transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import com.bloxbean.cardano.yaci.store.common.service.CursorService;
import com.bloxbean.cardano.yaci.store.core.service.EraService;
import com.bloxbean.cardano.yaci.store.events.EpochChangeEvent;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jooq.DSLContext;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand All @@ -27,7 +25,6 @@
havingValue = "true",
matchIfMissing = false
)
@RequiredArgsConstructor
@Slf4j
public class BalancePruningService {
private final CursorService cursorService;
Expand All @@ -40,7 +37,17 @@ public class BalancePruningService {

private AtomicBoolean isPruning = new AtomicBoolean(false);

@PostConstruct
public BalancePruningService(CursorService cursorService, EraService eraService, AccountStoreProperties accountStoreProperties,
DSLContext dslContext, PlatformTransactionManager transactionManager) {
this.cursorService = cursorService;
this.eraService = eraService;
this.accountStoreProperties = accountStoreProperties;
this.dslContext = dslContext;
this.transactionManager = transactionManager;

init();
}

public void init() {
log.info("<< Balance Pruning Service Enabled >>");
transactionTemplate = new TransactionTemplate(transactionManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.MeterRegistry;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.concurrent.atomic.AtomicLong;

@Service
@RequiredArgsConstructor
public class MetricCollectorService {
private final MeterRegistry meterRegistry;
private Counter negativeBalanceAddressCounter;
private Counter negativeBalanceStakeAddressCounter;
private AtomicLong lastAccountBalanceProcessedBlock;

@PostConstruct
public MetricCollectorService(MeterRegistry meterRegistry) {
this.meterRegistry = meterRegistry;
init();
}

private void init() {
setupMetrics();
}
Expand Down
Loading
Loading