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 10, 2024
1 parent 656664e commit 95f89fb
Show file tree
Hide file tree
Showing 40 changed files with 554 additions and 300 deletions.
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
}
return out, nil
}

// 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")
}
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
}
if interceptor == nil {
return srv.(UpdateServer).UpdateTimestamp(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/vald.v1.Update/UpdateTimestamp",
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(UpdateServer).UpdateTimestamp(ctx, req.(*payload.Object_Timestamp))
}
return interceptor(ctx, in, info, handler)
}

// 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
2 changes: 1 addition & 1 deletion dockers/agent/core/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ LABEL maintainer="vdaas.org vald team <[email protected]>"
COPY --from=builder /usr/bin/agent /usr/bin/agent
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/agent"]
ENTRYPOINT ["/usr/bin/agent"]
2 changes: 1 addition & 1 deletion dockers/agent/core/faiss/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ COPY --from=builder /usr/bin/faiss /usr/bin/faiss
COPY cmd/agent/core/faiss/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/faiss"]
ENTRYPOINT ["/usr/bin/faiss"]
2 changes: 1 addition & 1 deletion dockers/agent/core/ngt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ COPY --from=builder /usr/bin/ngt /usr/bin/ngt
COPY cmd/agent/core/ngt/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/ngt"]
ENTRYPOINT ["/usr/bin/ngt"]
2 changes: 1 addition & 1 deletion dockers/agent/sidecar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ LABEL maintainer="vdaas.org vald team <[email protected]>"
COPY --from=builder /usr/bin/sidecar /usr/bin/sidecar
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/sidecar"]
ENTRYPOINT ["/usr/bin/sidecar"]
2 changes: 1 addition & 1 deletion dockers/binfmt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
#

# DO_NOT_EDIT this Dockerfile is generated by https://github.com/vdaas/vald/blob/main/hack/docker/gen/main.go
FROM tonistiigi/binfmt:master AS builder
FROM tonistiigi/binfmt:master AS builder
2 changes: 1 addition & 1 deletion dockers/buildbase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
#

# DO_NOT_EDIT this Dockerfile is generated by https://github.com/vdaas/vald/blob/main/hack/docker/gen/main.go
FROM ubuntu:devel AS builder
FROM ubuntu:devel AS builder
2 changes: 1 addition & 1 deletion dockers/buildkit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
#

# DO_NOT_EDIT this Dockerfile is generated by https://github.com/vdaas/vald/blob/main/hack/docker/gen/main.go
FROM moby/buildkit:master AS builder
FROM moby/buildkit:master AS builder
4 changes: 2 additions & 2 deletions dockers/ci/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ ENV REPO=vald
ENV RUST_HOME=/usr/loacl/lib/rust
ENV TZ=Etc/UTC
ENV USER=root
ENV RUSTUP_HOME=${RUST_HOME}/rustup
ENV CARGO_HOME=${RUST_HOME}/cargo
ENV RUSTUP_HOME=${RUST_HOME}/rustup
ENV PATH=${CARGO_HOME}/bin:${GOPATH}/bin:${GOROOT}/bin:${RUSTUP_HOME}/bin:/usr/local/bin:${PATH}
WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down Expand Up @@ -123,4 +123,4 @@ RUN --mount=type=bind,target=.,rw \
&& rm -rf ${GOPATH}/src/github.com/${ORG}/${REPO}/*
# skipcq: DOK-DL3002
USER root:root
ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/bin/bash"]
4 changes: 2 additions & 2 deletions dockers/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ ENV REPO=vald
ENV RUST_HOME=/usr/loacl/lib/rust
ENV TZ=Etc/UTC
ENV USER=root
ENV CARGO_HOME=${RUST_HOME}/cargo
ENV RUSTUP_HOME=${RUST_HOME}/rustup
ENV CARGO_HOME=${RUST_HOME}/cargo
ENV PATH=${CARGO_HOME}/bin:${GOPATH}/bin:${GOROOT}/bin:${RUSTUP_HOME}/bin:/usr/local/bin:${PATH}
WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down Expand Up @@ -142,4 +142,4 @@ RUN --mount=type=bind,target=.,rw \
&& make faiss/install \
&& rm -rf ${GOPATH}/src/github.com/${ORG}/${REPO}/*
# skipcq: DOK-DL3002
USER root:root
USER root:root
2 changes: 1 addition & 1 deletion dockers/discoverer/k8s/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/discoverer /usr/bin/discoverer
COPY cmd/discoverer/k8s/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/discoverer"]
ENTRYPOINT ["/usr/bin/discoverer"]
2 changes: 1 addition & 1 deletion dockers/gateway/filter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/filter /usr/bin/filter
COPY cmd/gateway/filter/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/filter"]
ENTRYPOINT ["/usr/bin/filter"]
2 changes: 1 addition & 1 deletion dockers/gateway/lb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/lb /usr/bin/lb
COPY cmd/gateway/lb/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/lb"]
ENTRYPOINT ["/usr/bin/lb"]
2 changes: 1 addition & 1 deletion dockers/gateway/mirror/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/mirror /usr/bin/mirror
COPY cmd/gateway/mirror/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/mirror"]
ENTRYPOINT ["/usr/bin/mirror"]
2 changes: 1 addition & 1 deletion dockers/index/job/correction/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/index-correction /usr/bin/index-correction
COPY cmd/index/job/correction/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index-correction"]
ENTRYPOINT ["/usr/bin/index-correction"]
2 changes: 1 addition & 1 deletion dockers/index/job/creation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/index-creation /usr/bin/index-creation
COPY cmd/index/job/creation/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index-creation"]
ENTRYPOINT ["/usr/bin/index-creation"]
2 changes: 1 addition & 1 deletion dockers/index/job/readreplica/rotate/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/readreplica-rotate /usr/bin/readreplica-rotate
COPY cmd/index/job/readreplica/rotate/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/readreplica-rotate"]
ENTRYPOINT ["/usr/bin/readreplica-rotate"]
2 changes: 1 addition & 1 deletion dockers/index/job/save/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/index-save /usr/bin/index-save
COPY cmd/index/job/save/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index-save"]
ENTRYPOINT ["/usr/bin/index-save"]
2 changes: 1 addition & 1 deletion dockers/index/operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/index-operator /usr/bin/index-operator
COPY cmd/index/operator/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index-operator"]
ENTRYPOINT ["/usr/bin/index-operator"]
2 changes: 1 addition & 1 deletion dockers/manager/index/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ COPY --from=builder /usr/bin/index /usr/bin/index
COPY cmd/manager/index/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index"]
ENTRYPOINT ["/usr/bin/index"]
2 changes: 1 addition & 1 deletion dockers/operator/helm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ COPY --from=builder /opt/helm/charts/vald /opt/helm/charts/vald
COPY --from=builder /opt/helm/charts/vald-helm-operator /opt/helm/charts/vald-helm-operator
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/helm-operator", "run", "--watches-file=/opt/helm/watches.yaml"]
ENTRYPOINT ["/usr/bin/helm-operator", "run", "--watches-file=/opt/helm/watches.yaml"]
Loading

0 comments on commit 95f89fb

Please sign in to comment.