-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: User friendly Search request builder * docs: included search example in README * feat: Async search client
- Loading branch information
1 parent
80bb473
commit 723dc2a
Showing
19 changed files
with
440 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
client/src/main/java/com/tigrisdata/db/client/TigrisAsyncCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2022 Tigris Data, 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 com.tigrisdata.db.client; | ||
|
||
/** | ||
* Asynchronous callback to receive messages from server | ||
* | ||
* @param <T> type of message | ||
*/ | ||
public interface TigrisAsyncCallback<T> { | ||
|
||
/** | ||
* Receives a message from the stream. | ||
* | ||
* <p>Can be called many times but is never called after {@link #onError(Throwable)} or {@link | ||
* #onCompleted()} are called. | ||
* | ||
* <p>If an exception is thrown by an implementation the caller is expected to terminate the | ||
* stream by calling {@link #onError(Throwable)} with the caught exception prior to propagating | ||
* it. | ||
* | ||
* @param message the value passed from the server | ||
*/ | ||
void onNext(T message); | ||
|
||
/** | ||
* Receives terminating error from the stream. | ||
* | ||
* @param t captures the error | ||
*/ | ||
void onError(Throwable t); | ||
|
||
/** | ||
* Receives a notification of successful stream completion. | ||
* | ||
* <p>May only be called once and if called it must be the last method called. In particular if an | ||
* exception is thrown by an implementation of {@code onCompleted} no further calls to any method | ||
* are allowed. | ||
*/ | ||
void onCompleted(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
client/src/main/java/com/tigrisdata/db/client/TigrisAsyncSearchReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2022 Tigris Data, 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 com.tigrisdata.db.client; | ||
|
||
import com.tigrisdata.db.client.search.SearchResult; | ||
import com.tigrisdata.db.type.TigrisCollectionType; | ||
|
||
/** | ||
* Asynchronous callback to receive {@link SearchResult} from server | ||
* | ||
* @param <T> Collection type | ||
*/ | ||
public interface TigrisAsyncSearchReader<T extends TigrisCollectionType> | ||
extends TigrisAsyncCallback<SearchResult<T>> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.