Skip to content

Commit

Permalink
Add all DocumentService/SearchService function stubs.
Browse files Browse the repository at this point in the history
Signed-off-by: Finn Carroll <[email protected]>
  • Loading branch information
finnegancarroll committed Nov 15, 2024
1 parent 56c8940 commit 06d1aa2
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.grpc.services;

import io.grpc.stub.StreamObserver;
import opensearch.protos.BulkRequest;
import opensearch.protos.BulkResponse;
import opensearch.protos.DeleteDocumentRequest;
import opensearch.protos.DeleteDocumentResponse;
import opensearch.protos.GetDocumentRequest;
import opensearch.protos.GetDocumentResponse;
import opensearch.protos.GetDocumentSourceRequest;
import opensearch.protos.GetDocumentSourceResponse;
import opensearch.protos.IndexBulkRequest;
import opensearch.protos.IndexBulkResponse;
import opensearch.protos.IndexDocumentCreateIdRequest;
import opensearch.protos.IndexDocumentCreateIdResponse;
import opensearch.protos.IndexDocumentIdRequest;
import opensearch.protos.IndexDocumentIdResponse;
import opensearch.protos.IndexDocumentRequest;
import opensearch.protos.IndexDocumentResponse;
import opensearch.protos.UpdateDocumentRequest;
import opensearch.protos.UpdateDocumentResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.client.node.NodeClient;

import opensearch.proto.services.DocumentServiceGrpc;

public class DocumentServiceImpl extends DocumentServiceGrpc.DocumentServiceImplBase {
private static final Logger logger = LogManager.getLogger(DocumentServiceImpl.class);
private final NodeClient client;

public DocumentServiceImpl(NodeClient client) {
this.client = client;
}

@Override
public void indexDocument(IndexDocumentRequest request, StreamObserver<IndexDocumentResponse> responseObserver) {
super.indexDocument(request, responseObserver);
}

@Override
public void indexDocumentId(IndexDocumentIdRequest request, StreamObserver<IndexDocumentIdResponse> responseObserver) {
super.indexDocumentId(request, responseObserver);
}

@Override
public void indexDocumentCreateId(IndexDocumentCreateIdRequest request, StreamObserver<IndexDocumentCreateIdResponse> responseObserver) {
super.indexDocumentCreateId(request, responseObserver);
}

@Override
public void bulk(BulkRequest request, StreamObserver<BulkResponse> responseObserver) {
super.bulk(request, responseObserver);
}

@Override
public void indexBulk(IndexBulkRequest request, StreamObserver<IndexBulkResponse> responseObserver) {
super.indexBulk(request, responseObserver);
}

@Override
public void deleteDocument(DeleteDocumentRequest request, StreamObserver<DeleteDocumentResponse> responseObserver) {
super.deleteDocument(request, responseObserver);
}

@Override
public void updateDocument(UpdateDocumentRequest request, StreamObserver<UpdateDocumentResponse> responseObserver) {
super.updateDocument(request, responseObserver);
}

@Override
public void getDocument(GetDocumentRequest request, StreamObserver<GetDocumentResponse> responseObserver) {
super.getDocument(request, responseObserver);
}

@Override
public void getDocumentSource(GetDocumentSourceRequest request, StreamObserver<GetDocumentSourceResponse> responseObserver) {
super.getDocumentSource(request, responseObserver);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.grpc.services;

import io.grpc.stub.StreamObserver;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.client.node.NodeClient;

import opensearch.proto.services.SearchServiceGrpc;
import opensearch.protos.ExplainRequest;
import opensearch.protos.ExplainResponse;
import opensearch.protos.IndexSearchRequest;
import opensearch.protos.IndexSearchResponse;
import opensearch.protos.SearchRequest;
import opensearch.protos.SearchResponse;

public class SearchServiceImpl extends SearchServiceGrpc.SearchServiceImplBase {
private static final Logger logger = LogManager.getLogger(SearchServiceImpl.class);
private final NodeClient client;

public SearchServiceImpl(NodeClient client) {
this.client = client;
}

@Override
public void search(SearchRequest request, StreamObserver<SearchResponse> responseObserver) {
super.search(request, responseObserver);
}

@Override
public void indexSearch(IndexSearchRequest request, StreamObserver<IndexSearchResponse> responseObserver) {
super.indexSearch(request, responseObserver);
}

@Override
public void explain(ExplainRequest request, StreamObserver<ExplainResponse> responseObserver) {
super.explain(request, responseObserver);
}
}
2 changes: 1 addition & 1 deletion server/src/main/proto/services/Document.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ service DocumentService {
/*Consolidate to IndexDocument*/
rpc IndexDocument(IndexDocumentRequest) returns (IndexDocumentResponse) {}
rpc IndexDocumentId(IndexDocumentIdRequest) returns (IndexDocumentIdResponse) {}
rpc IndexDocumentCreateIdRequest(IndexDocumentCreateIdRequest) returns (IndexDocumentCreateIdResponse) {}
rpc IndexDocumentCreateId(IndexDocumentCreateIdRequest) returns (IndexDocumentCreateIdResponse) {}

/*Consolidate to Bulk*/
rpc Bulk(BulkRequest) returns (BulkResponse) {}
Expand Down

0 comments on commit 06d1aa2

Please sign in to comment.