Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] IndexInfo API moved from Agent Client to Vald Client #30

Merged
merged 8 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ PROTOS = \
v1/vald/filter.proto \
v1/vald/insert.proto \
v1/vald/object.proto \
v1/vald/index.proto \
v1/vald/remove.proto \
v1/vald/search.proto \
v1/vald/update.proto \
Expand Down
2 changes: 1 addition & 1 deletion VALD_SHA
Original file line number Diff line number Diff line change
@@ -1 +1 @@
284fdb57b3afedecd330101968ba393381e58085
702e85153e90cdfea37c857e6f3a5cfd56755afa
3 changes: 2 additions & 1 deletion src/tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from vald.v1.vald import upsert_pb2_grpc
from vald.v1.vald import remove_pb2_grpc
from vald.v1.vald import object_pb2_grpc
from vald.v1.vald import index_pb2_grpc
from vald.v1.payload import payload_pb2


Expand Down Expand Up @@ -79,7 +80,7 @@ def test_save_index(self):
self.assertIsInstance(result, payload_pb2.Empty)

def test_index_info(self):
stub = agent_pb2_grpc.AgentStub(self.channel)
stub = index_pb2_grpc.IndexStub(self.channel)
result = stub.IndexInfo(payload_pb2.Empty())
self.assertIsInstance(result, payload_pb2.Info.Index.Count)
self.assertEqual(result.stored, 99)
Expand Down
12 changes: 4 additions & 8 deletions src/vald/v1/agent/core/agent_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 0 additions & 88 deletions src/vald/v1/agent/core/agent_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ def __init__(self, channel):
request_serializer=vald_dot_v1_dot_payload_dot_payload__pb2.Control.CreateIndexRequest.SerializeToString,
response_deserializer=vald_dot_v1_dot_payload_dot_payload__pb2.Empty.FromString,
_registered_method=True)
self.IndexInfo = channel.unary_unary(
'/core.v1.Agent/IndexInfo',
request_serializer=vald_dot_v1_dot_payload_dot_payload__pb2.Empty.SerializeToString,
response_deserializer=vald_dot_v1_dot_payload_dot_payload__pb2.Info.Index.Count.FromString,
_registered_method=True)
self.GetTimestamp = channel.unary_unary(
'/core.v1.Agent/GetTimestamp',
request_serializer=vald_dot_v1_dot_payload_dot_payload__pb2.Object.GetTimestampRequest.SerializeToString,
response_deserializer=vald_dot_v1_dot_payload_dot_payload__pb2.Object.Timestamp.FromString,
_registered_method=True)


class AgentServicer(object):
Expand Down Expand Up @@ -67,20 +57,6 @@ def CreateAndSaveIndex(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def IndexInfo(self, request, context):
"""Represent the RPC to get the agent index information.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def GetTimestamp(self, request, context):
"""Represent the RPC to get the vector metadata. This RPC is mainly used for index correction process
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_AgentServicer_to_server(servicer, server):
rpc_method_handlers = {
Expand All @@ -99,16 +75,6 @@ def add_AgentServicer_to_server(servicer, server):
request_deserializer=vald_dot_v1_dot_payload_dot_payload__pb2.Control.CreateIndexRequest.FromString,
response_serializer=vald_dot_v1_dot_payload_dot_payload__pb2.Empty.SerializeToString,
),
'IndexInfo': grpc.unary_unary_rpc_method_handler(
servicer.IndexInfo,
request_deserializer=vald_dot_v1_dot_payload_dot_payload__pb2.Empty.FromString,
response_serializer=vald_dot_v1_dot_payload_dot_payload__pb2.Info.Index.Count.SerializeToString,
),
'GetTimestamp': grpc.unary_unary_rpc_method_handler(
servicer.GetTimestamp,
request_deserializer=vald_dot_v1_dot_payload_dot_payload__pb2.Object.GetTimestampRequest.FromString,
response_serializer=vald_dot_v1_dot_payload_dot_payload__pb2.Object.Timestamp.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'core.v1.Agent', rpc_method_handlers)
Expand Down Expand Up @@ -201,57 +167,3 @@ def CreateAndSaveIndex(request,
timeout,
metadata,
_registered_method=True)

@staticmethod
def IndexInfo(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(
request,
target,
'/core.v1.Agent/IndexInfo',
vald_dot_v1_dot_payload_dot_payload__pb2.Empty.SerializeToString,
vald_dot_v1_dot_payload_dot_payload__pb2.Info.Index.Count.FromString,
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def GetTimestamp(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(
request,
target,
'/core.v1.Agent/GetTimestamp',
vald_dot_v1_dot_payload_dot_payload__pb2.Object.GetTimestampRequest.SerializeToString,
vald_dot_v1_dot_payload_dot_payload__pb2.Object.Timestamp.FromString,
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)
Loading
Loading