Skip to content

Commit

Permalink
feat: support open table with tableOptions (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
foreverneverer authored Sep 7, 2021
1 parent 8498aa1 commit 88491ed
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 20 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci-license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#

name: CI - License
on:
pull_request:
branches:
- master

jobs:
license-check:
name: License check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: check license
run: mvn license:check
51 changes: 51 additions & 0 deletions .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#

name: CI - Test
on:
pull_request:
branches:
- master
- 'v[0-9]+.*' # release branch
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
test:
name: test
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11']
steps:
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: ci
run: ./scripts/ci-test.sh
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/travis.sh → scripts/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function shellcheck_must_pass()
exit 1
fi
}
shellcheck_must_pass ./scripts/travis.sh
shellcheck_must_pass ./scripts/ci-test.sh

# check format
sbt scalafmtSbtCheck scalafmtCheck test:scalafmtCheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.xiaomi.infra.pegasus.scalaclient

import java.util.Properties

import com.xiaomi.infra.pegasus.client.{
PException,
TableOptions,
PegasusClientInterface => IClient
}
import com.xiaomi.infra.pegasus.scalaclient.{Serializer => SER}
Expand All @@ -28,10 +28,18 @@ trait ScalaPegasusClient extends PegasusUtil {
def openTable(table: String) =
new ScalaPegasusTableImpl(client.openTable(table))

@throws[PException]
def openTable(table: String, options: TableOptions) =
new ScalaPegasusTableImpl(client.openTable(table, options))

@throws[PException]
def openAsyncTable(table: String) =
new ScalaPegasusAsyncTableImpl(client.openTable(table))

@throws[PException]
def openAsyncTable(table: String, options: TableOptions) =
new ScalaPegasusAsyncTableImpl(client.openTable(table, options))

private def getTable(table: String) = openTable(table)

@throws[PException]
Expand Down

0 comments on commit 88491ed

Please sign in to comment.