Skip to content

Commit

Permalink
Merge branch 'main' into test-request-order
Browse files Browse the repository at this point in the history
  • Loading branch information
zymap authored Jul 30, 2024
2 parents 4de1310 + 3df43a9 commit 510bb3f
Show file tree
Hide file tree
Showing 64 changed files with 2,727 additions and 42 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/dispatch-perf-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: DockerHub Publish

on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
publish-docker:
name: Publish docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./perf-ycsb
platforms: linux/x86_64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ steps.meta.outputs.tags }}
cache-to: type=inline
6 changes: 5 additions & 1 deletion client-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@
<parent>
<groupId>io.streamnative.oxia</groupId>
<artifactId>oxia-java</artifactId>
<version>0.3.1-SNAPSHOT</version>
<version>0.3.2-SNAPSHOT</version>
</parent>

<artifactId>oxia-client-api</artifactId>
<name>Oxia Client API</name>

<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright © 2022-2024 StreamNative Inc.
*
* Licensed 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.
*/
package io.streamnative.oxia.client.api;

import io.grpc.Metadata;

public interface Authentication {

Metadata generateCredentials();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright © 2022-2024 StreamNative Inc.
*
* Licensed 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.
*/
package io.streamnative.oxia.client.api;

public enum AuthenticationType {
Bearer;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright © 2022-2024 StreamNative Inc.
*
* Licensed 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.
*/
package io.streamnative.oxia.client.api;

/** Support for encoded authentication configuration parameters. */
public interface EncodedAuthenticationParameterSupport {

/**
* Plugins which use ":" and/or "," in a configuration parameter value need to implement this
* interface.
*
* @param encodedAuthParamString
*/
void configure(String encodedAuthParamString);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

import io.opentelemetry.api.OpenTelemetry;
import io.streamnative.oxia.client.api.exceptions.OxiaException;
import io.streamnative.oxia.client.api.exceptions.UnsupportedAuthenticationException;
import io.streamnative.oxia.client.internal.DefaultImplementation;
import java.io.File;
import java.time.Duration;
import java.util.Properties;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;

Expand Down Expand Up @@ -47,4 +50,43 @@ static OxiaClientBuilder create(String serviceAddress) {
OxiaClientBuilder clientIdentifier(Supplier<String> clientIdentifier);

OxiaClientBuilder openTelemetry(OpenTelemetry openTelemetry);

OxiaClientBuilder authentication(Authentication authentication);

/**
* Configure the authentication plugin and its parameters.
*
* @param authPluginClassName the class name of the authentication plugin
* @param authParamsString the parameters of the authentication plugin
* @return the OxiaClientBuilder instance
* @throws UnsupportedAuthenticationException if the authentication plugin is not supported
*/
OxiaClientBuilder authentication(String authPluginClassName, String authParamsString)
throws UnsupportedAuthenticationException;

OxiaClientBuilder enableTls(boolean enableTls);

/**
* Load the configuration from the specified configuration file.
*
* @param configPath the path of the configuration file
* @return the OxiaClientBuilder instance
*/
OxiaClientBuilder loadConfig(String configPath);

/**
* Load the configuration from the specified configuration file.
*
* @param configFile the configuration file
* @return the OxiaClientBuilder instance
*/
OxiaClientBuilder loadConfig(File configFile);

/**
* Load the configuration from the specified properties.
*
* @param properties the properties
* @return the OxiaClientBuilder instance
*/
OxiaClientBuilder loadConfig(Properties properties);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ public abstract class OxiaException extends Exception {
OxiaException(String message) {
super(message);
}

OxiaException(String message, Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright © 2022-2024 StreamNative Inc.
*
* Licensed 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.
*/
package io.streamnative.oxia.client.api.exceptions;

/** Unsupported authentication exception thrown by Oxia client. */
public class UnsupportedAuthenticationException extends OxiaException {
/**
* Constructs an {@code UnsupportedAuthenticationException} with the specified detail message.
*
* @param msg The detail message (which is saved for later retrieval by the {@link #getMessage()}
* method)
*/
public UnsupportedAuthenticationException(String msg) {
super(msg);
}

/**
* Constructs an {@code UnsupportedAuthenticationException} with the specified detail message and
* cause.
*
* @param msg The detail message (which is saved for later retrieval by the {@link #getMessage()}
* method)
* @param cause The cause (which is saved for later retrieval by the {@link #getCause()} method).
* (A {@code null} value is permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public UnsupportedAuthenticationException(String msg, Throwable cause) {
super(msg, cause);
}
}
2 changes: 1 addition & 1 deletion client-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.streamnative.oxia</groupId>
<artifactId>oxia-java</artifactId>
<version>0.3.1-SNAPSHOT</version>
<version>0.3.2-SNAPSHOT</version>
</parent>

<artifactId>oxia-client-it</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>io.streamnative.oxia</groupId>
<artifactId>oxia-java</artifactId>
<version>0.3.1-SNAPSHOT</version>
<version>0.3.2-SNAPSHOT</version>
</parent>

<artifactId>oxia-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AsyncOxiaClientImpl implements AsyncOxiaClient {
static @NonNull CompletableFuture<AsyncOxiaClient> newInstance(@NonNull ClientConfig config) {
ScheduledExecutorService executor =
Executors.newSingleThreadScheduledExecutor(new DefaultThreadFactory("oxia-client"));
var stubManager = new OxiaStubManager();
var stubManager = new OxiaStubManager(config.authentication(), config.enableTls());

var instrumentProvider = new InstrumentProvider(config.openTelemetry(), config.namespace());
var serviceAddrStub = stubManager.getStub(config.serviceAddress());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
package io.streamnative.oxia.client;

import io.opentelemetry.api.OpenTelemetry;
import io.streamnative.oxia.client.api.Authentication;
import java.time.Duration;
import javax.annotation.Nullable;
import lombok.NonNull;

public record ClientConfig(
Expand All @@ -28,4 +30,6 @@ public record ClientConfig(
@NonNull Duration sessionTimeout,
@NonNull String clientIdentifier,
OpenTelemetry openTelemetry,
@NonNull String namespace) {}
@NonNull String namespace,
@Nullable Authentication authentication,
boolean enableTls) {}
Loading

0 comments on commit 510bb3f

Please sign in to comment.