Skip to content

Commit

Permalink
Add UpdateTimestamp API
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
  • Loading branch information
kpango committed Aug 12, 2024
1 parent 4fb802d commit 74bd03f
Show file tree
Hide file tree
Showing 50 changed files with 743 additions and 485 deletions.
7 changes: 5 additions & 2 deletions .gitfiles
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ Makefile
Makefile.d/actions.mk
Makefile.d/bench.mk
Makefile.d/build.mk
Makefile.d/client.mk
Makefile.d/dependencies.mk
Makefile.d/docker.mk
Makefile.d/e2e.mk
Expand Down Expand Up @@ -1904,6 +1903,11 @@ rust/libs/ngt-rs/src/input.h
rust/libs/ngt-rs/src/lib.rs
rust/libs/ngt/Cargo.toml
rust/libs/ngt/src/lib.rs
rust/libs/observability/Cargo.toml
rust/libs/observability/src/config.rs
rust/libs/observability/src/lib.rs
rust/libs/observability/src/macros.rs
rust/libs/observability/src/observability.rs
rust/libs/proto/Cargo.toml
rust/libs/proto/src/core.v1.tonic.rs
rust/libs/proto/src/discoverer.v1.tonic.rs
Expand Down Expand Up @@ -1965,7 +1969,6 @@ versions/PROTOBUF_VERSION
versions/REVIEWDOG_VERSION
versions/RUST_VERSION
versions/TELEPRESENCE_VERSION
versions/VALDCLI_VERSION
versions/VALD_VERSION
versions/YQ_VERSION
versions/ZLIB_VERSION
Expand Down
2 changes: 1 addition & 1 deletion .github/helm/values/values-correction.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

defaults:
logging:
level: info
level: debug
networkPolicy:
enabled: true
gateway:
Expand Down
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ PROTOBUF_VERSION := $(eval PROTOBUF_VERSION := $(shell cat versions/PRO
REVIEWDOG_VERSION := $(eval REVIEWDOG_VERSION := $(shell cat versions/REVIEWDOG_VERSION))$(REVIEWDOG_VERSION)
RUST_VERSION := $(eval RUST_VERSION := $(shell cat versions/RUST_VERSION))$(RUST_VERSION)
TELEPRESENCE_VERSION := $(eval TELEPRESENCE_VERSION := $(shell cat versions/TELEPRESENCE_VERSION))$(TELEPRESENCE_VERSION)
VALDCLI_VERSION := $(eval VALDCLI_VERSION := $(shell cat versions/VALDCLI_VERSION))$(VALDCLI_VERSION)
YQ_VERSION := $(eval YQ_VERSION := $(shell cat versions/YQ_VERSION))$(YQ_VERSION)
ZLIB_VERSION := $(eval ZLIB_VERSION := $(shell cat versions/ZLIB_VERSION))$(ZLIB_VERSION)

Expand Down Expand Up @@ -455,7 +454,6 @@ init: \
tools/install: \
helm/install \
kind/install \
valdcli/install \
telepresence/install \
textlint/install

Expand Down Expand Up @@ -620,10 +618,6 @@ version/helm:
version/yq:
@echo $(YQ_VERSION)

.PHONY: version/valdcli
version/valdcli:
@echo $(VALDCLI_VERSION)

.PHONY: version/telepresence
version/telepresence:
@echo $(TELEPRESENCE_VERSION)
Expand Down Expand Up @@ -766,7 +760,6 @@ changelog/next/print:
include Makefile.d/actions.mk
include Makefile.d/bench.mk
include Makefile.d/build.mk
include Makefile.d/client.mk
include Makefile.d/dependencies.mk
include Makefile.d/docker.mk
include Makefile.d/e2e.mk
Expand All @@ -775,7 +768,7 @@ include Makefile.d/helm.mk
include Makefile.d/k3d.mk
include Makefile.d/k8s.mk
include Makefile.d/kind.mk
include Makefile.d/minikube.mk
include Makefile.d/proto.mk
include Makefile.d/test.mk
include Makefile.d/tools.mk
include Makefile.d/minikube.mk
45 changes: 0 additions & 45 deletions Makefile.d/client.mk

This file was deleted.

6 changes: 0 additions & 6 deletions Makefile.d/dependencies.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ update/libs: \
update/rust \
update/telepresence \
update/vald \
update/valdcli \
update/yq \
update/zlib

Expand Down Expand Up @@ -227,11 +226,6 @@ update/hdf5:
update/vald:
curl -fsSL https://api.github.com/repos/$(REPO)/releases/latest | grep -Po '"tag_name": "\K.*?(?=")' > $(ROOTDIR)/versions/VALD_VERSION

.PHONY: update/valdcli
## update vald client library made by clojure self version
update/valdcli:
curl -fsSL https://api.github.com/repos/$(REPO)-client-clj/releases/latest | grep -Po '"tag_name": "\K.*?(?=")' > $(ROOTDIR)/versions/VALDCLI_VERSION

.PHONY: update/template
## update PULL_REQUEST_TEMPLATE and ISSUE_TEMPLATE
update/template:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ make init
## Contributors

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-18-orange.svg?style=flat-square)](#contributors)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Expand Down
11 changes: 6 additions & 5 deletions apis/docs/v1/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1664,11 +1664,12 @@ Search service provides ways to search indexed vectors.

Update service provides ways to update indexed vectors.

| Method Name | Request Type | Response Type | Description |
| ------------ | ------------------------------------------------------------------ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| Update | [.payload.v1.Update.Request](#payload-v1-Update-Request) | [.payload.v1.Object.Location](#payload-v1-Object-Location) | A method to update an indexed vector. |
| StreamUpdate | [.payload.v1.Update.Request](#payload-v1-Update-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to update multiple indexed vectors by bidirectional streaming. |
| MultiUpdate | [.payload.v1.Update.MultiRequest](#payload-v1-Update-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to update multiple indexed vectors in a single request. |
| Method Name | Request Type | Response Type | Description |
| --------------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| Update | [.payload.v1.Update.Request](#payload-v1-Update-Request) | [.payload.v1.Object.Location](#payload-v1-Object-Location) | A method to update an indexed vector. |
| StreamUpdate | [.payload.v1.Update.Request](#payload-v1-Update-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to update multiple indexed vectors by bidirectional streaming. |
| MultiUpdate | [.payload.v1.Update.MultiRequest](#payload-v1-Update-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to update multiple indexed vectors in a single request. |
| UpdateTimestamp | [.payload.v1.Object.Timestamp](#payload-v1-Object-Timestamp) | [.payload.v1.Object.Location](#payload-v1-Object-Location) | A method to update timestamp an indexed vector. |

<a name="v1_vald_upsert-proto"></a>

Expand Down
41 changes: 25 additions & 16 deletions apis/grpc/v1/vald/update.pb.go

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

45 changes: 45 additions & 0 deletions apis/grpc/v1/vald/update_vtproto.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ type UpdateClient interface {
StreamUpdate(ctx context.Context, opts ...grpc.CallOption) (Update_StreamUpdateClient, error)
// A method to update multiple indexed vectors in a single request.
MultiUpdate(ctx context.Context, in *payload.Update_MultiRequest, opts ...grpc.CallOption) (*payload.Object_Locations, error)
// A method to update timestamp an indexed vector.
UpdateTimestamp(ctx context.Context, in *payload.Object_Timestamp, opts ...grpc.CallOption) (*payload.Object_Location, error)
}

type updateClient struct {
Expand Down Expand Up @@ -113,6 +115,17 @@ func (c *updateClient) MultiUpdate(
return out, nil
}

func (c *updateClient) UpdateTimestamp(
ctx context.Context, in *payload.Object_Timestamp, opts ...grpc.CallOption,
) (*payload.Object_Location, error) {
out := new(payload.Object_Location)
err := c.cc.Invoke(ctx, "/vald.v1.Update/UpdateTimestamp", in, out, opts...)
if err != nil {
return nil, err

Check warning on line 124 in apis/grpc/v1/vald/update_vtproto.pb.go

View check run for this annotation

Codecov / codecov/patch

apis/grpc/v1/vald/update_vtproto.pb.go#L120-L124

Added lines #L120 - L124 were not covered by tests
}
return out, nil

Check warning on line 126 in apis/grpc/v1/vald/update_vtproto.pb.go

View check run for this annotation

Codecov / codecov/patch

apis/grpc/v1/vald/update_vtproto.pb.go#L126

Added line #L126 was not covered by tests
}

// UpdateServer is the server API for Update service.
// All implementations must embed UnimplementedUpdateServer
// for forward compatibility
Expand All @@ -123,6 +136,8 @@ type UpdateServer interface {
StreamUpdate(Update_StreamUpdateServer) error
// A method to update multiple indexed vectors in a single request.
MultiUpdate(context.Context, *payload.Update_MultiRequest) (*payload.Object_Locations, error)
// A method to update timestamp an indexed vector.
UpdateTimestamp(context.Context, *payload.Object_Timestamp) (*payload.Object_Location, error)
mustEmbedUnimplementedUpdateServer()
}

Expand All @@ -144,6 +159,12 @@ func (UnimplementedUpdateServer) MultiUpdate(
) (*payload.Object_Locations, error) {
return nil, status.Errorf(codes.Unimplemented, "method MultiUpdate not implemented")
}

func (UnimplementedUpdateServer) UpdateTimestamp(
context.Context, *payload.Object_Timestamp,
) (*payload.Object_Location, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateTimestamp not implemented")

Check warning on line 166 in apis/grpc/v1/vald/update_vtproto.pb.go

View check run for this annotation

Codecov / codecov/patch

apis/grpc/v1/vald/update_vtproto.pb.go#L165-L166

Added lines #L165 - L166 were not covered by tests
}
func (UnimplementedUpdateServer) mustEmbedUnimplementedUpdateServer() {}

// UnsafeUpdateServer may be embedded to opt out of forward compatibility for this service.
Expand Down Expand Up @@ -223,6 +244,26 @@ func _Update_MultiUpdate_Handler(
return interceptor(ctx, in, info, handler)
}

func _Update_UpdateTimestamp_Handler(
srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor,
) (any, error) {
in := new(payload.Object_Timestamp)
if err := dec(in); err != nil {
return nil, err

Check warning on line 252 in apis/grpc/v1/vald/update_vtproto.pb.go

View check run for this annotation

Codecov / codecov/patch

apis/grpc/v1/vald/update_vtproto.pb.go#L249-L252

Added lines #L249 - L252 were not covered by tests
}
if interceptor == nil {
return srv.(UpdateServer).UpdateTimestamp(ctx, in)

Check warning on line 255 in apis/grpc/v1/vald/update_vtproto.pb.go

View check run for this annotation

Codecov / codecov/patch

apis/grpc/v1/vald/update_vtproto.pb.go#L254-L255

Added lines #L254 - L255 were not covered by tests
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/vald.v1.Update/UpdateTimestamp",

Check warning on line 259 in apis/grpc/v1/vald/update_vtproto.pb.go

View check run for this annotation

Codecov / codecov/patch

apis/grpc/v1/vald/update_vtproto.pb.go#L257-L259

Added lines #L257 - L259 were not covered by tests
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(UpdateServer).UpdateTimestamp(ctx, req.(*payload.Object_Timestamp))

Check warning on line 262 in apis/grpc/v1/vald/update_vtproto.pb.go

View check run for this annotation

Codecov / codecov/patch

apis/grpc/v1/vald/update_vtproto.pb.go#L261-L262

Added lines #L261 - L262 were not covered by tests
}
return interceptor(ctx, in, info, handler)

Check warning on line 264 in apis/grpc/v1/vald/update_vtproto.pb.go

View check run for this annotation

Codecov / codecov/patch

apis/grpc/v1/vald/update_vtproto.pb.go#L264

Added line #L264 was not covered by tests
}

// Update_ServiceDesc is the grpc.ServiceDesc for Update service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
Expand All @@ -238,6 +279,10 @@ var Update_ServiceDesc = grpc.ServiceDesc{
MethodName: "MultiUpdate",
Handler: _Update_MultiUpdate_Handler,
},
{
MethodName: "UpdateTimestamp",
Handler: _Update_UpdateTimestamp_Handler,
},
},
Streams: []grpc.StreamDesc{
{
Expand Down
1 change: 1 addition & 0 deletions apis/grpc/v1/vald/vald.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const (
UpdateObjectRPCName = "UpdateObject"
StreamUpdateObjectRPCName = "StreamUpdateObject"
MultiUpdateObjectRPCName = "MultiUpdateObject"
UpdateTimestampRPCName = "UpdateTimestamp"

UpsertRPCName = "Upsert"
StreamUpsertRPCName = "StreamUpsert"
Expand Down
8 changes: 8 additions & 0 deletions apis/proto/v1/vald/update.proto
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,12 @@ service Update {
body: "*"
};
}

// A method to update timestamp an indexed vector.
rpc UpdateTimestamp(payload.v1.Object.Timestamp) returns (payload.v1.Object.Location) {
option (google.api.http) = {
post: "/update"
body: "*"
};
}
}
23 changes: 19 additions & 4 deletions apis/swagger/v1/vald/update.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"paths": {
"/update": {
"post": {
"summary": "A method to update an indexed vector.",
"operationId": "Update_Update",
"summary": "A method to update timestamp an indexed vector.",
"operationId": "Update_UpdateTimestamp",
"responses": {
"200": {
"description": "A successful response.",
Expand All @@ -33,11 +33,11 @@
"parameters": [
{
"name": "body",
"description": "Represent the update request.",
"description": "Represent a vector meta data.",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1UpdateRequest"
"$ref": "#/definitions/v1ObjectTimestamp"
}
}
],
Expand Down Expand Up @@ -212,6 +212,21 @@
},
"description": "Represent the vector location."
},
"v1ObjectTimestamp": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The vector ID."
},
"timestamp": {
"type": "string",
"format": "int64",
"description": "timestamp represents when this vector inserted."
}
},
"description": "Represent a vector meta data."
},
"v1UpdateConfig": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit 74bd03f

Please sign in to comment.