-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement prototype of agent grpc server (#2492)
* implement prototype of agent grpc server * make format --------- Co-authored-by: Hiroto Funakoshi <[email protected]>
- Loading branch information
Showing
13 changed files
with
563 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Copyright (C) 2019-2024 vdaas.org vald team <[email protected]> | ||
// | ||
// 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 | ||
// | ||
// https://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. | ||
// | ||
mod common; | ||
mod index; | ||
mod insert; | ||
mod remove; | ||
mod search; | ||
mod update; | ||
mod upsert; | ||
|
||
#[derive(Default, Debug)] | ||
pub struct Agent { | ||
|
||
} |
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,21 @@ | ||
// | ||
// Copyright (C) 2019-2024 vdaas.org vald team <[email protected]> | ||
// | ||
// 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 | ||
// | ||
// https://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. | ||
// | ||
#[macro_export] | ||
macro_rules! stream_type { | ||
($t:ty) => { | ||
std::pin::Pin<Box<dyn tokio_stream::Stream<Item = std::result::Result<$t, tonic::Status>> + Send>> | ||
}; | ||
} |
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,60 @@ | ||
// | ||
// Copyright (C) 2019-2024 vdaas.org vald team <[email protected]> | ||
// | ||
// 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 | ||
// | ||
// https://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. | ||
// | ||
use proto::{ | ||
core::v1::agent_server, | ||
payload::v1::{control, info, object, Empty}, | ||
}; | ||
|
||
#[tonic::async_trait] | ||
impl agent_server::Agent for super::Agent { | ||
async fn create_index( | ||
&self, | ||
request: tonic::Request<control::CreateIndexRequest>, | ||
) -> std::result::Result<tonic::Response<Empty>, tonic::Status> { | ||
todo!() | ||
} | ||
|
||
async fn save_index( | ||
&self, | ||
request: tonic::Request<Empty>, | ||
) -> std::result::Result<tonic::Response<Empty>, tonic::Status> { | ||
todo!() | ||
} | ||
|
||
#[doc = " Represent the creating and saving index RPC.\n"] | ||
async fn create_and_save_index( | ||
&self, | ||
request: tonic::Request<control::CreateIndexRequest>, | ||
) -> std::result::Result<tonic::Response<Empty>, tonic::Status> { | ||
todo!() | ||
} | ||
|
||
#[doc = " Represent the RPC to get the agent index information.\n"] | ||
async fn index_info( | ||
&self, | ||
request: tonic::Request<Empty>, | ||
) -> std::result::Result<tonic::Response<info::index::Count>, tonic::Status> { | ||
todo!() | ||
} | ||
|
||
#[doc = " Represent the RPC to get the vector metadata. This RPC is mainly used for index correction process\n"] | ||
async fn get_timestamp( | ||
&self, | ||
request: tonic::Request<object::GetTimestampRequest>, | ||
) -> std::result::Result<tonic::Response<object::Timestamp>, tonic::Status> { | ||
todo!() | ||
} | ||
} |
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,47 @@ | ||
// | ||
// Copyright (C) 2019-2024 vdaas.org vald team <[email protected]> | ||
// | ||
// 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 | ||
// | ||
// https://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. | ||
// | ||
use proto::{ | ||
payload::v1::{insert, object}, | ||
vald::v1::insert_server, | ||
}; | ||
#[tonic::async_trait] | ||
impl insert_server::Insert for super::Agent { | ||
async fn insert( | ||
&self, | ||
request: tonic::Request<insert::Request>, | ||
) -> std::result::Result<tonic::Response<object::Location>, tonic::Status> { | ||
todo!() | ||
} | ||
|
||
#[doc = " Server streaming response type for the StreamInsert method."] | ||
type StreamInsertStream = crate::stream_type!(object::StreamLocation); | ||
|
||
#[doc = " A method to add new multiple vectors by bidirectional streaming.\n"] | ||
async fn stream_insert( | ||
&self, | ||
request: tonic::Request<tonic::Streaming<insert::Request>>, | ||
) -> std::result::Result<tonic::Response<Self::StreamInsertStream>, tonic::Status> { | ||
todo!() | ||
} | ||
|
||
#[doc = " A method to add new multiple vectors in a single request.\n"] | ||
async fn multi_insert( | ||
&self, | ||
request: tonic::Request<insert::MultiRequest>, | ||
) -> std::result::Result<tonic::Response<object::Locations>, tonic::Status> { | ||
todo!() | ||
} | ||
} |
Oops, something went wrong.