From 402147d7d8406e390ab3285b7f9a974fc841884a Mon Sep 17 00:00:00 2001 From: Kanro Date: Mon, 30 Oct 2023 12:41:57 +0800 Subject: [PATCH] :bug: Add default impl for hbase delete (#537) * :green_heart: Fix publish * :bug: Add default impl for hbase delete * Make ktlint happy --- .github/workflows/build.yml | 8 ++++---- .github/workflows/publish.yml | 11 ++++------- .../sisyphus/middleware/hbase/HTableTemplate.kt | 11 +++++++++++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f01cb0da..7f728970 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,14 +4,14 @@ on: pull_request: branches: [ master ] +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.7.0 - with: - access_token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/checkout@v2 - name: Set up JDK 17 uses: actions/setup-java@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d3404242..a36f0e52 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,16 +7,16 @@ on: release: types: [ prereleased, released ] +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.7.0 - with: - access_token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/checkout@v2 - name: Set up JDK 17 uses: actions/setup-java@v3 @@ -41,6 +41,3 @@ jobs: gpg-key-name: ${{ secrets.GPG_KEY_NAME }} - name: Publish with Gradle run: gradle publish --no-daemon - - name: Publish plugins to Gradle Portal - if: ${{ github.event_name == 'release' }} - run: gradle publishPlugins --no-daemon diff --git a/middleware/sisyphus-hbase/src/main/kotlin/com/bybutter/sisyphus/middleware/hbase/HTableTemplate.kt b/middleware/sisyphus-hbase/src/main/kotlin/com/bybutter/sisyphus/middleware/hbase/HTableTemplate.kt index c434be20..514c38cb 100644 --- a/middleware/sisyphus-hbase/src/main/kotlin/com/bybutter/sisyphus/middleware/hbase/HTableTemplate.kt +++ b/middleware/sisyphus-hbase/src/main/kotlin/com/bybutter/sisyphus/middleware/hbase/HTableTemplate.kt @@ -7,6 +7,7 @@ import com.bybutter.sisyphus.middleware.hbase.annotation.HTable import com.bybutter.sisyphus.reflect.uncheckedCast import org.apache.hadoop.hbase.TableName import org.apache.hadoop.hbase.client.Connection +import org.apache.hadoop.hbase.client.Delete import org.apache.hadoop.hbase.client.Get import org.apache.hadoop.hbase.client.Put import org.apache.hadoop.hbase.client.Scan @@ -112,4 +113,14 @@ abstract class HTableTemplate : HTemplate) { return setMap(values.toMap()) } + + override fun delete(vararg keys: TKey) { + connection.getTable(TableName.valueOf(table)).use { + val deleteRequests = + keys.map { + Delete(rowKeyConverter.convert(it)) + } + it.delete(deleteRequests) + } + } }