Skip to content

Commit

Permalink
[feat]: support error listener when write metric failure
Browse files Browse the repository at this point in the history
  • Loading branch information
stone1100 committed Apr 4, 2023
1 parent b291d2e commit c8e4fb7
Show file tree
Hide file tree
Showing 25 changed files with 366 additions and 45 deletions.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/🐛-bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: "\U0001F41B Bug report"
about: I want to report a Bug.
title: '[bug]:'
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce** (Required)
Steps to reproduce the behavior:

**Expected behavior** (Required)
A clear and concise description of what you expected to happen.

**What's your LinDB/Client version?** (Required)
Insert output of `lind version` here.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/🚀-enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: "\U0001F680 Enhancement"
about: I want to make an enhancement.
title: '[enhance]:'
labels: enhancement
assignees: ''

---

**Please describe enhancement**
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/🚀-feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: "\U0001F680 Feature request"
about: I want to request a New Feature on the product.
title: '[feature]:'
labels: feature
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/🤔-ask-a-question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: "\U0001F914 Ask a Question"
about: I want to ask a question.
title: '[question]:'
labels: question
assignees: ''

---

**Describe your question**
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### What problem does this PR solve?

Issue Number: #xxx

Problem Summary:


### Check List

Tests

- [ ] Unit test
- [ ] Integration test
- [ ] No code
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: LinDB Client Java CI
on: [push, pull_request]
name: LinDB Java Client CI
on:
pull_request:
push:
branches:
- main
jobs:
test-with-coverage:
name: Build & Uint Test
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/publish_ossrh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Pushlish Java Client to OSSRH
on:
workflow_dispatch:
release:
types: [published,released]

jobs:
test-with-coverage:
name: Build & Uint Test
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
run: mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ help: ## display help
header: ## check and add license header.
mvn license:format

test: ## run test cases
test: header## run test cases
# mvn test -Dtest=WriteImplTest
mvn test

Expand Down
10 changes: 6 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>lindb-client</artifactId>
<groupId>io.lindb</groupId>
<version>0.0.1</version>
<version>0.0.2</version>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

Expand Down Expand Up @@ -94,7 +94,7 @@
<dependency>
<groupId>com.google.flatbuffers</groupId>
<artifactId>flatbuffers-java</artifactId>
<version>2.0.8</version>
<version>23.3.3</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
Expand All @@ -106,14 +106,14 @@
<artifactId>slf4j-api</artifactId>
<version>2.0.3</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.4</version>
<scope>test</scope>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -312,10 +312,12 @@
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@

package io.lindb.client.flat.metrics.v1;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
import com.google.flatbuffers.BaseVector;
import com.google.flatbuffers.BooleanVector;
import com.google.flatbuffers.ByteVector;
import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table;
import com.google.flatbuffers.UnionVector;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

@javax.annotation.Generated(value="flatc")
@SuppressWarnings("unused")
public final class CompoundField extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_3_3(); }
public static CompoundField getRootAsCompoundField(ByteBuffer _bb) { return getRootAsCompoundField(_bb, new CompoundField()); }
public static CompoundField getRootAsCompoundField(ByteBuffer _bb, CompoundField obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
Expand Down
22 changes: 17 additions & 5 deletions src/generated/java/io/lindb/client/flat/metrics/v1/Exemplar.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@

package io.lindb.client.flat.metrics.v1;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
import com.google.flatbuffers.BaseVector;
import com.google.flatbuffers.BooleanVector;
import com.google.flatbuffers.ByteVector;
import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table;
import com.google.flatbuffers.UnionVector;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

@javax.annotation.Generated(value="flatc")
@SuppressWarnings("unused")
public final class Exemplar extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_3_3(); }
public static Exemplar getRootAsExemplar(ByteBuffer _bb) { return getRootAsExemplar(_bb, new Exemplar()); }
public static Exemplar getRootAsExemplar(ByteBuffer _bb, Exemplar obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
Expand Down
22 changes: 17 additions & 5 deletions src/generated/java/io/lindb/client/flat/metrics/v1/KeyValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@

package io.lindb.client.flat.metrics.v1;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
import com.google.flatbuffers.BaseVector;
import com.google.flatbuffers.BooleanVector;
import com.google.flatbuffers.ByteVector;
import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table;
import com.google.flatbuffers.UnionVector;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

@javax.annotation.Generated(value="flatc")
@SuppressWarnings("unused")
public final class KeyValue extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_3_3(); }
public static KeyValue getRootAsKeyValue(ByteBuffer _bb) { return getRootAsKeyValue(_bb, new KeyValue()); }
public static KeyValue getRootAsKeyValue(ByteBuffer _bb, KeyValue obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
Expand Down
22 changes: 17 additions & 5 deletions src/generated/java/io/lindb/client/flat/metrics/v1/Metric.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@

package io.lindb.client.flat.metrics.v1;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
import com.google.flatbuffers.BaseVector;
import com.google.flatbuffers.BooleanVector;
import com.google.flatbuffers.ByteVector;
import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table;
import com.google.flatbuffers.UnionVector;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

@javax.annotation.Generated(value="flatc")
@SuppressWarnings("unused")
public final class Metric extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_3_3(); }
public static Metric getRootAsMetric(ByteBuffer _bb) { return getRootAsMetric(_bb, new Metric()); }
public static Metric getRootAsMetric(ByteBuffer _bb, Metric obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@

package io.lindb.client.flat.metrics.v1;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
import com.google.flatbuffers.BaseVector;
import com.google.flatbuffers.BooleanVector;
import com.google.flatbuffers.ByteVector;
import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table;
import com.google.flatbuffers.UnionVector;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

@javax.annotation.Generated(value="flatc")
@SuppressWarnings("unused")
public final class SimpleField extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_3_3(); }
public static SimpleField getRootAsSimpleField(ByteBuffer _bb) { return getRootAsSimpleField(_bb, new SimpleField()); }
public static SimpleField getRootAsSimpleField(ByteBuffer _bb, SimpleField obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/io/lindb/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.io.IOException;

import io.lindb.client.api.EventListener;
import io.lindb.client.api.Write;

/**
Expand All @@ -34,4 +35,14 @@ public interface Client {
* @throws IOException if send data error
*/
Write write(String database) throws IOException;

/**
* Create write client.
*
* @param database database name {@link String}
* @param listener the listener to listen events
* @return write client {@link Write}
* @throws IOException if send data error
*/
Write write(String database, EventListener listener) throws IOException;
}
Loading

0 comments on commit c8e4fb7

Please sign in to comment.