Skip to content

Commit

Permalink
add mirror definition and update proto dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: hlts2 <[email protected]>
  • Loading branch information
hlts2 committed Mar 3, 2023
1 parent f4b9404 commit 568db0d
Show file tree
Hide file tree
Showing 15 changed files with 1,574 additions and 432 deletions.
63 changes: 63 additions & 0 deletions apis/docs/v1/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
- [Insert.MultiRequest](#payload-v1-Insert-MultiRequest)
- [Insert.ObjectRequest](#payload-v1-Insert-ObjectRequest)
- [Insert.Request](#payload-v1-Insert-Request)
- [Mirror](#payload-v1-Mirror)
- [Mirror.Target](#payload-v1-Mirror-Target)
- [Mirror.Targets](#payload-v1-Mirror-Targets)
- [Object](#payload-v1-Object)
- [Object.Blob](#payload-v1-Object-Blob)
- [Object.Distance](#payload-v1-Object-Distance)
Expand Down Expand Up @@ -100,6 +103,8 @@
- [Update](#vald-v1-Update)
- [apis/proto/v1/vald/upsert.proto](#apis_proto_v1_vald_upsert-proto)
- [Upsert](#vald-v1-Upsert)
- [apis/proto/v1/mirror/mirror.proto](#apis_proto_v1_mirror_mirror-proto)
- [Mirror](#mirror-v1-Mirror)
- [Scalar Value Types](#scalar-value-types)

<a name="apis_proto_v1_agent_core_agent-proto"></a>
Expand Down Expand Up @@ -473,6 +478,33 @@ Represent the insert request.
| vector | [Object.Vector](#payload-v1-Object-Vector) | | The vector to be inserted. |
| config | [Insert.Config](#payload-v1-Insert-Config) | | The configuration of the insert request. |

<a name="payload-v1-Mirror"></a>

### Mirror

Mirror related messages.

<a name="payload-v1-Mirror-Target"></a>

### Mirror.Target

Represent server information.

| Field | Type | Label | Description |
| ----- | ----------------- | ----- | ---------------- |
| ip | [string](#string) | | The target ip. |
| port | [uint32](#uint32) | | The target port. |

<a name="payload-v1-Mirror-Targets"></a>

### Mirror.Targets

Represent the multiple Target message.

| Field | Type | Label | Description |
| ------- | ------------------------------------------ | -------- | -------------------------------- |
| targets | [Mirror.Target](#payload-v1-Mirror-Target) | repeated | The multiple target information. |

<a name="payload-v1-Object"></a>

### Object
Expand Down Expand Up @@ -1053,6 +1085,37 @@ Upsert service provides ways to insert/update vectors.
| StreamUpsert | [.payload.v1.Upsert.Request](#payload-v1-Upsert-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to insert/update multiple vectors by bidirectional streaming. |
| MultiUpsert | [.payload.v1.Upsert.MultiRequest](#payload-v1-Upsert-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to insert/update multiple vectors in a single request. |

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

<p align="right"><a href="#top">Top</a></p>

## apis/proto/v1/mirror/mirror.proto

Copyright (C) 2019-2022 vdaas.org vald team &lt;[email protected]&gt;

Licensed under the Apache License, Version 2.0 (the &#34;License&#34;);
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 &#34;AS IS&#34; 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.

<a name="mirror-v1-Mirror"></a>

### Mirror

Represent the mirror service.

| Method Name | Request Type | Response Type | Description |
| ----------- | -------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------- |
| Register | [.payload.v1.Mirror.Targets](#payload-v1-Mirror-Targets) | [.payload.v1.Mirror.Targets](#payload-v1-Mirror-Targets) | Register is the RPC to register other mirror servers. |
| Advertise | [.payload.v1.Mirror.Targets](#payload-v1-Mirror-Targets) | [.payload.v1.Mirror.Targets](#payload-v1-Mirror-Targets) | Advertise is the RPC to advertise other mirror servers. |

## Scalar Value Types

| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
Expand Down
112 changes: 112 additions & 0 deletions apis/grpc/v1/mirror/mirror.pb.go

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

165 changes: 165 additions & 0 deletions apis/grpc/v1/mirror/mirror_vtproto.pb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
//
// Copyright (C) 2019-2023 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.
//

package mirror

import (
context "context"

payload "github.com/vdaas/vald/apis/grpc/v1/payload"
codes "github.com/vdaas/vald/internal/net/grpc/codes"
status "github.com/vdaas/vald/internal/net/grpc/status"
grpc "google.golang.org/grpc"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)

const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

// 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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// MirrorClient is the client API for Mirror 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.
type MirrorClient interface {
// Register is the RPC to register other mirror servers.
Register(ctx context.Context, in *payload.Mirror_Targets, opts ...grpc.CallOption) (*payload.Mirror_Targets, error)
// Advertise is the RPC to advertise other mirror servers.
Advertise(ctx context.Context, in *payload.Mirror_Targets, opts ...grpc.CallOption) (*payload.Mirror_Targets, error)
}

type mirrorClient struct {
cc grpc.ClientConnInterface
}

func NewMirrorClient(cc grpc.ClientConnInterface) MirrorClient {
return &mirrorClient{cc}
}

func (c *mirrorClient) Register(ctx context.Context, in *payload.Mirror_Targets, opts ...grpc.CallOption) (*payload.Mirror_Targets, error) {
out := new(payload.Mirror_Targets)
err := c.cc.Invoke(ctx, "/mirror.v1.Mirror/Register", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

func (c *mirrorClient) Advertise(ctx context.Context, in *payload.Mirror_Targets, opts ...grpc.CallOption) (*payload.Mirror_Targets, error) {
out := new(payload.Mirror_Targets)
err := c.cc.Invoke(ctx, "/mirror.v1.Mirror/Advertise", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

// MirrorServer is the server API for Mirror service.
// All implementations must embed UnimplementedMirrorServer
// for forward compatibility
type MirrorServer interface {
// Register is the RPC to register other mirror servers.
Register(context.Context, *payload.Mirror_Targets) (*payload.Mirror_Targets, error)
// Advertise is the RPC to advertise other mirror servers.
Advertise(context.Context, *payload.Mirror_Targets) (*payload.Mirror_Targets, error)
mustEmbedUnimplementedMirrorServer()
}

// UnimplementedMirrorServer must be embedded to have forward compatible implementations.
type UnimplementedMirrorServer struct {
}

func (UnimplementedMirrorServer) Register(context.Context, *payload.Mirror_Targets) (*payload.Mirror_Targets, error) {
return nil, status.Errorf(codes.Unimplemented, "method Register not implemented")
}
func (UnimplementedMirrorServer) Advertise(context.Context, *payload.Mirror_Targets) (*payload.Mirror_Targets, error) {
return nil, status.Errorf(codes.Unimplemented, "method Advertise not implemented")
}
func (UnimplementedMirrorServer) mustEmbedUnimplementedMirrorServer() {}

// UnsafeMirrorServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MirrorServer will
// result in compilation errors.
type UnsafeMirrorServer interface {
mustEmbedUnimplementedMirrorServer()
}

func RegisterMirrorServer(s grpc.ServiceRegistrar, srv MirrorServer) {
s.RegisterService(&Mirror_ServiceDesc, srv)
}

func _Mirror_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(payload.Mirror_Targets)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MirrorServer).Register(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/mirror.v1.Mirror/Register",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MirrorServer).Register(ctx, req.(*payload.Mirror_Targets))
}
return interceptor(ctx, in, info, handler)
}

func _Mirror_Advertise_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(payload.Mirror_Targets)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MirrorServer).Advertise(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/mirror.v1.Mirror/Advertise",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MirrorServer).Advertise(ctx, req.(*payload.Mirror_Targets))
}
return interceptor(ctx, in, info, handler)
}

// Mirror_ServiceDesc is the grpc.ServiceDesc for Mirror service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Mirror_ServiceDesc = grpc.ServiceDesc{
ServiceName: "mirror.v1.Mirror",
HandlerType: (*MirrorServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Register",
Handler: _Mirror_Register_Handler,
},
{
MethodName: "Advertise",
Handler: _Mirror_Advertise_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "apis/proto/v1/mirror/mirror.proto",
}
Loading

0 comments on commit 568db0d

Please sign in to comment.