Files
seaweedfs/weed/pb/vector_pb/vector_grpc.pb.go
T
Chris LuandClaude Opus 5.5 e109f91c6f vector: indexed metadata keys, engine side (derive, rewrite, exact planner, filter counter) (#12813)
* vector: derive the indexed metadata key columns

An indexed metadata key is a hidden `_mk_<n>` column of List<Utf8>: the
strings an S3 `$eq` on a string matches, that is the value when it is a
string or the string elements of an array, and nothing for any other type
or a missing key. The field metadata names the key and its state
(`building` or `ready`).

The module derives the column from metadata given as JSON (the write
path) or as stored (jsonb or JSON text, for a backfill), and reads the
indexed keys from a schema. It lives in the worker crate so the engine and
the worker share it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: fill the indexed metadata key columns on PutVectors

PutVectors builds its batch against the table's current schema. Once a
table has indexed metadata key columns, the three-column batch no longer
matches that schema and the write fails. Fill each `_mk_*` column the
schema has from the row's metadata, whatever the key's state; a column
the engine does not know still fails the request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: answer string $eq and $in on a ready indexed key from its column

The gateway renders a string `$eq` or `$in` on a key as an OR of
`json_extract(metadata, P) = '"v"'` (or IN) and
`json_array_contains(metadata, P, '"v"')` over the same values. On the
parsed filter, a top-level conjunct of that shape on a key whose column is
`ready` becomes `array_has` / `array_has_any` on the column, which its
LABEL_LIST index answers. The two halves must name the same key and the
same strings, the scalar half in the text json_extract returns for them;
anything else, including `$ne`, `$nin`, `$exists`, numbers and booleans,
stays on the JSON path, and the other conjuncts still apply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: score few indexed matches exactly, per scope

With a ready indexed key in the filter, `ann` first counts the rows of its
scope that the key's conjuncts match, through the scalar index. When they
are at most the limit it scores them exactly over that scope, the way
the short-result fallback does; above it, the vector index searches with
the indexed prefilter, and the fallback still applies. The scope is the
one `exact_in_scope` scores, so per-scope exact answers merge into the
global exact top-k.

The limit is `Query::exact_match_limit` (None takes 256; 0 never counts),
set by the engine's --exact-match-limit (WEED_VECTOR_EXACT_MATCH_LIMIT).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: count filtered queries by metadata key

For each index, the engine counts its QueryVectors calls by the metadata
keys of the parsed filter, with their total latency and the operand types
each key was compared with, over the last hour in 5-minute buckets. At most
512 indexes and 32 keys per index are kept (an idle key makes room;
otherwise the index is marked truncated), and the stats are not exported
as metrics labels.

The new FilterStats RPC returns an index's stats; the gateway's discovery
client forwards it like the other calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: report the metadata columns capability in gRPC health

An engine whose writes fill the indexed metadata key columns reports the
gRPC health service `weed.vector.capability.metadata_columns` as serving,
so an operator action can refuse to index a key while an older engine
could still write the table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: expire filter stats' operand kinds and truncation with the window

The operand kinds a key was compared with, and the mark that a key went
uncounted, outlived the queries that set them. Keep the kinds per
5-minute bucket and the truncation as the bucket it last happened in, so
both leave the hour window with the counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: fill indexed key columns a write left empty racing their add

A PutVectors that opened the table before an indexed key's column was
added, and commits after the add, is rebased by Lance onto the wider
schema: it commits, and the rows it wrote hold NULL in the new column, so
the column's index misses them (reproduced in the test: 100 of 150 rows).

After its commit, PutVectors now looks for indexed-key columns the batch
did not carry, reads those of its keys whose column is still NULL, derives
the values from their stored metadata and patches just those columns with
a partial-schema merge that updates only rows still NULL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK

* vector: keep filter stats' truncation mark at the later bucket

record() reads the clock before it takes the lock, so a call that waited
on the lock across a bucket boundary could move the truncation mark (and
the index's last-used bucket) back to its earlier bucket, and the mark
then left the window one bucket early.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* vector: derive a raced write's indexed key columns from current metadata

A PutVectors that opened the table before an indexed key's column was
added is retried by Lance against the wider schema: rows it inserts hold
NULL there, and rows it updates keep the value derived from their old
metadata, which the NULL-only heal never looked at. The heal now derives
the columns for all of the write's keys.

Its merge also ran with Lance's retry, which joins the values derived
before the conflict onto the rows a later write of the same keys left.
It now fails on a conflict and is redone from the latest version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* vector: check the raced write's keys keep the later write's rows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:45:30 -08:00

400 lines
16 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v3.21.12
// source: vector.proto
package vector_pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
VectorService_CreateIndex_FullMethodName = "/vector_pb.VectorService/CreateIndex"
VectorService_DropIndex_FullMethodName = "/vector_pb.VectorService/DropIndex"
VectorService_PutVectors_FullMethodName = "/vector_pb.VectorService/PutVectors"
VectorService_GetVectors_FullMethodName = "/vector_pb.VectorService/GetVectors"
VectorService_DeleteVectors_FullMethodName = "/vector_pb.VectorService/DeleteVectors"
VectorService_ListVectors_FullMethodName = "/vector_pb.VectorService/ListVectors"
VectorService_QueryVectors_FullMethodName = "/vector_pb.VectorService/QueryVectors"
VectorService_FilterStats_FullMethodName = "/vector_pb.VectorService/FilterStats"
)
// VectorServiceClient is the client API for VectorService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// The shared contract between the Go S3 gateway and the vector query engine.
// The public S3 Vectors API stays an AWS contract; this RPC is the internal
// boundary the design doc gives both editions.
type VectorServiceClient interface {
CreateIndex(ctx context.Context, in *CreateIndexRequest, opts ...grpc.CallOption) (*CreateIndexResponse, error)
DropIndex(ctx context.Context, in *DropIndexRequest, opts ...grpc.CallOption) (*DropIndexResponse, error)
PutVectors(ctx context.Context, in *PutVectorsRequest, opts ...grpc.CallOption) (*PutVectorsResponse, error)
GetVectors(ctx context.Context, in *GetVectorsRequest, opts ...grpc.CallOption) (*GetVectorsResponse, error)
DeleteVectors(ctx context.Context, in *DeleteVectorsRequest, opts ...grpc.CallOption) (*DeleteVectorsResponse, error)
ListVectors(ctx context.Context, in *ListVectorsRequest, opts ...grpc.CallOption) (*ListVectorsResponse, error)
QueryVectors(ctx context.Context, in *QueryVectorsRequest, opts ...grpc.CallOption) (*QueryVectorsResponse, error)
// How this engine's queries of an index filtered on each metadata key
// over the last hour.
FilterStats(ctx context.Context, in *FilterStatsRequest, opts ...grpc.CallOption) (*FilterStatsResponse, error)
}
type vectorServiceClient struct {
cc grpc.ClientConnInterface
}
func NewVectorServiceClient(cc grpc.ClientConnInterface) VectorServiceClient {
return &vectorServiceClient{cc}
}
func (c *vectorServiceClient) CreateIndex(ctx context.Context, in *CreateIndexRequest, opts ...grpc.CallOption) (*CreateIndexResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateIndexResponse)
err := c.cc.Invoke(ctx, VectorService_CreateIndex_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *vectorServiceClient) DropIndex(ctx context.Context, in *DropIndexRequest, opts ...grpc.CallOption) (*DropIndexResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DropIndexResponse)
err := c.cc.Invoke(ctx, VectorService_DropIndex_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *vectorServiceClient) PutVectors(ctx context.Context, in *PutVectorsRequest, opts ...grpc.CallOption) (*PutVectorsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PutVectorsResponse)
err := c.cc.Invoke(ctx, VectorService_PutVectors_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *vectorServiceClient) GetVectors(ctx context.Context, in *GetVectorsRequest, opts ...grpc.CallOption) (*GetVectorsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetVectorsResponse)
err := c.cc.Invoke(ctx, VectorService_GetVectors_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *vectorServiceClient) DeleteVectors(ctx context.Context, in *DeleteVectorsRequest, opts ...grpc.CallOption) (*DeleteVectorsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteVectorsResponse)
err := c.cc.Invoke(ctx, VectorService_DeleteVectors_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *vectorServiceClient) ListVectors(ctx context.Context, in *ListVectorsRequest, opts ...grpc.CallOption) (*ListVectorsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListVectorsResponse)
err := c.cc.Invoke(ctx, VectorService_ListVectors_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *vectorServiceClient) QueryVectors(ctx context.Context, in *QueryVectorsRequest, opts ...grpc.CallOption) (*QueryVectorsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryVectorsResponse)
err := c.cc.Invoke(ctx, VectorService_QueryVectors_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *vectorServiceClient) FilterStats(ctx context.Context, in *FilterStatsRequest, opts ...grpc.CallOption) (*FilterStatsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FilterStatsResponse)
err := c.cc.Invoke(ctx, VectorService_FilterStats_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// VectorServiceServer is the server API for VectorService service.
// All implementations must embed UnimplementedVectorServiceServer
// for forward compatibility.
//
// The shared contract between the Go S3 gateway and the vector query engine.
// The public S3 Vectors API stays an AWS contract; this RPC is the internal
// boundary the design doc gives both editions.
type VectorServiceServer interface {
CreateIndex(context.Context, *CreateIndexRequest) (*CreateIndexResponse, error)
DropIndex(context.Context, *DropIndexRequest) (*DropIndexResponse, error)
PutVectors(context.Context, *PutVectorsRequest) (*PutVectorsResponse, error)
GetVectors(context.Context, *GetVectorsRequest) (*GetVectorsResponse, error)
DeleteVectors(context.Context, *DeleteVectorsRequest) (*DeleteVectorsResponse, error)
ListVectors(context.Context, *ListVectorsRequest) (*ListVectorsResponse, error)
QueryVectors(context.Context, *QueryVectorsRequest) (*QueryVectorsResponse, error)
// How this engine's queries of an index filtered on each metadata key
// over the last hour.
FilterStats(context.Context, *FilterStatsRequest) (*FilterStatsResponse, error)
mustEmbedUnimplementedVectorServiceServer()
}
// UnimplementedVectorServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedVectorServiceServer struct{}
func (UnimplementedVectorServiceServer) CreateIndex(context.Context, *CreateIndexRequest) (*CreateIndexResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CreateIndex not implemented")
}
func (UnimplementedVectorServiceServer) DropIndex(context.Context, *DropIndexRequest) (*DropIndexResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DropIndex not implemented")
}
func (UnimplementedVectorServiceServer) PutVectors(context.Context, *PutVectorsRequest) (*PutVectorsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method PutVectors not implemented")
}
func (UnimplementedVectorServiceServer) GetVectors(context.Context, *GetVectorsRequest) (*GetVectorsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetVectors not implemented")
}
func (UnimplementedVectorServiceServer) DeleteVectors(context.Context, *DeleteVectorsRequest) (*DeleteVectorsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteVectors not implemented")
}
func (UnimplementedVectorServiceServer) ListVectors(context.Context, *ListVectorsRequest) (*ListVectorsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListVectors not implemented")
}
func (UnimplementedVectorServiceServer) QueryVectors(context.Context, *QueryVectorsRequest) (*QueryVectorsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method QueryVectors not implemented")
}
func (UnimplementedVectorServiceServer) FilterStats(context.Context, *FilterStatsRequest) (*FilterStatsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method FilterStats not implemented")
}
func (UnimplementedVectorServiceServer) mustEmbedUnimplementedVectorServiceServer() {}
func (UnimplementedVectorServiceServer) testEmbeddedByValue() {}
// UnsafeVectorServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to VectorServiceServer will
// result in compilation errors.
type UnsafeVectorServiceServer interface {
mustEmbedUnimplementedVectorServiceServer()
}
func RegisterVectorServiceServer(s grpc.ServiceRegistrar, srv VectorServiceServer) {
// If the following call panics, it indicates UnimplementedVectorServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&VectorService_ServiceDesc, srv)
}
func _VectorService_CreateIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateIndexRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VectorServiceServer).CreateIndex(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: VectorService_CreateIndex_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VectorServiceServer).CreateIndex(ctx, req.(*CreateIndexRequest))
}
return interceptor(ctx, in, info, handler)
}
func _VectorService_DropIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DropIndexRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VectorServiceServer).DropIndex(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: VectorService_DropIndex_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VectorServiceServer).DropIndex(ctx, req.(*DropIndexRequest))
}
return interceptor(ctx, in, info, handler)
}
func _VectorService_PutVectors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PutVectorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VectorServiceServer).PutVectors(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: VectorService_PutVectors_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VectorServiceServer).PutVectors(ctx, req.(*PutVectorsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _VectorService_GetVectors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetVectorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VectorServiceServer).GetVectors(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: VectorService_GetVectors_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VectorServiceServer).GetVectors(ctx, req.(*GetVectorsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _VectorService_DeleteVectors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteVectorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VectorServiceServer).DeleteVectors(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: VectorService_DeleteVectors_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VectorServiceServer).DeleteVectors(ctx, req.(*DeleteVectorsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _VectorService_ListVectors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListVectorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VectorServiceServer).ListVectors(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: VectorService_ListVectors_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VectorServiceServer).ListVectors(ctx, req.(*ListVectorsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _VectorService_QueryVectors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryVectorsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VectorServiceServer).QueryVectors(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: VectorService_QueryVectors_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VectorServiceServer).QueryVectors(ctx, req.(*QueryVectorsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _VectorService_FilterStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FilterStatsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VectorServiceServer).FilterStats(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: VectorService_FilterStats_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VectorServiceServer).FilterStats(ctx, req.(*FilterStatsRequest))
}
return interceptor(ctx, in, info, handler)
}
// VectorService_ServiceDesc is the grpc.ServiceDesc for VectorService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var VectorService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "vector_pb.VectorService",
HandlerType: (*VectorServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateIndex",
Handler: _VectorService_CreateIndex_Handler,
},
{
MethodName: "DropIndex",
Handler: _VectorService_DropIndex_Handler,
},
{
MethodName: "PutVectors",
Handler: _VectorService_PutVectors_Handler,
},
{
MethodName: "GetVectors",
Handler: _VectorService_GetVectors_Handler,
},
{
MethodName: "DeleteVectors",
Handler: _VectorService_DeleteVectors_Handler,
},
{
MethodName: "ListVectors",
Handler: _VectorService_ListVectors_Handler,
},
{
MethodName: "QueryVectors",
Handler: _VectorService_QueryVectors_Handler,
},
{
MethodName: "FilterStats",
Handler: _VectorService_FilterStats_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "vector.proto",
}