Use bytes in control service proto definition for chainID #885

Merged
fyrchik merged 2 commits from dkirillov/frostfs-node:feature/control_api_make_chain_id_bytes into master 2024-01-11 07:24:27 +00:00
10 changed files with 91 additions and 81 deletions

View file

@ -3,6 +3,7 @@ package control
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
@ -42,6 +43,15 @@ func addRule(cmd *cobra.Command, _ []string) {
pk := key.Get(cmd)
chainID, _ := cmd.Flags().GetString(chainIDFlag)
hexEncoded, _ := cmd.Flags().GetBool(chainIDHexFlag)
chainIDRaw := []byte(chainID)
if hexEncoded {
var err error
chainIDRaw, err = hex.DecodeString(chainID)
commonCmd.ExitOnErr(cmd, "can't decode chain ID as hex: %w", err)
}
var cnr cid.ID
cidStr, _ := cmd.Flags().GetString(commonflags.CIDFlag)
@ -54,7 +64,7 @@ func addRule(cmd *cobra.Command, _ []string) {
chain := new(apechain.Chain)
commonCmd.ExitOnErr(cmd, "parser error: %w", util.ParseAPEChain(chain, []string{rule}))
chain.ID = apechain.ID(chainID)
chain.ID = apechain.ID(chainIDRaw)
serializedChain := chain.Bytes()
cmd.Println("CID: " + cidStr)
@ -84,7 +94,8 @@ func addRule(cmd *cobra.Command, _ []string) {
verifyResponse(cmd, resp.GetSignature(), resp.GetBody())
cmd.Println("Rule has been added. Chain id: ", resp.GetBody().GetChainId())
chainIDRaw = resp.GetBody().GetChainId()
cmd.Printf("Rule has been added.\nChain id: '%s'\nChain id hex: '%x'\n", string(chainIDRaw), chainIDRaw)
}
func initControlAddRuleCmd() {
@ -94,4 +105,5 @@ func initControlAddRuleCmd() {
ff.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)
ff.String(ruleFlag, "", "Rule statement")
ff.String(chainIDFlag, "", "Assign ID to the parsed chain")
ff.Bool(chainIDHexFlag, false, "Flag to parse chain ID as hex")
}

View file

@ -2,6 +2,7 @@ package control
import (
"crypto/sha256"
"encoding/hex"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
@ -31,6 +32,13 @@ func getRule(cmd *cobra.Command, _ []string) {
cnr.Encode(rawCID)
chainID, _ := cmd.Flags().GetString(chainIDFlag)
hexEncoded, _ := cmd.Flags().GetBool(chainIDHexFlag)
if hexEncoded {
dstepanov-yadro marked this conversation as resolved Outdated

Is chain ID user-defined string? If so, then hex looks redundant

Is chain ID user-defined string? If so, then hex looks redundant

Yes, it's can be user-defined. But in case when we add local overrides from IAM service ids can be not-printable so we need some way to provide such id using frostfs-cli

Yes, it's can be user-defined. But in case when we add local overrides from IAM service ids can be not-printable so we need some way to provide such id using `frostfs-cli`
chainIDBytes, err := hex.DecodeString(chainID)
commonCmd.ExitOnErr(cmd, "can't decode chain ID as hex: %w", err)
chainID = string(chainIDBytes)
}
req := &control.GetChainLocalOverrideRequest{
Body: &control.GetChainLocalOverrideRequest_Body{
@ -38,7 +46,7 @@ func getRule(cmd *cobra.Command, _ []string) {
Name: cidStr,
Type: control.ChainTarget_CONTAINER,
},
ChainId: chainID,
ChainId: []byte(chainID),
},
}
@ -60,7 +68,7 @@ func getRule(cmd *cobra.Command, _ []string) {
commonCmd.ExitOnErr(cmd, "decode error: %w", chain.DecodeBytes(resp.GetBody().GetChain()))
// TODO (aarifullin): make pretty-formatted output for chains.
cmd.Println("Parsed chain:\n" + prettyJSONFormat(cmd, chain.Bytes()))
cmd.Printf("Parsed chain (chain id hex: '%x'):\n%s\n", chain.ID, prettyJSONFormat(cmd, chain.Bytes()))
}
func initControGetRuleCmd() {
@ -69,4 +77,5 @@ func initControGetRuleCmd() {
ff := getRuleCmd.Flags()
ff.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)
ff.String(chainIDFlag, "", "Chain id")
ff.Bool(chainIDHexFlag, false, "Flag to parse chain ID as hex")
}

View file

@ -63,7 +63,7 @@ func listRules(cmd *cobra.Command, _ []string) {
// TODO (aarifullin): make pretty-formatted output for chains.
var chain apechain.Chain
commonCmd.ExitOnErr(cmd, "decode error: %w", chain.DecodeBytes(c))
cmd.Println("Parsed chain:\n" + prettyJSONFormat(cmd, chain.Bytes()))
cmd.Printf("Parsed chain (chain id hex: '%x'):\n%s\n", chain.ID, prettyJSONFormat(cmd, chain.Bytes()))
fyrchik marked this conversation as resolved Outdated

Can we use utf8.IsValid and do not output string on false?

Can we use `utf8.IsValid` and do not output string on false?

Do you mean not output json chain or which one string?

Do you mean not output json chain or which one string?

Oh, sorry, thought it was a name.

Oh, sorry, thought it was a name.
}
}

View file

@ -2,6 +2,7 @@ package control
import (
"crypto/sha256"
"encoding/hex"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
@ -13,7 +14,8 @@ import (
)
const (
chainIDFlag = "chain-id"
chainIDFlag = "chain-id"
chainIDHexFlag = "chain-id-hex"

Hex is not needed for cli, cli is for user.

Hex is not needed for cli, cli is for user.

Yes, but we can set overrides via IAM #885 (comment)

Yes, but we can set overrides via IAM https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/885#issuecomment-29780

We need this in control service, but hex-encoding is a purely CLI thing.

We need this in control service, but hex-encoding is a purely CLI thing.

Let's consider the use-case:

  1. Someone (e.g. IAM) set non-utf8 id
  2. User using cli lists all policies and see policy from step 1
  3. User want to delete/get policy from step 1. He needs somehow pass non-utf8 id via CLI

If this isn't a case, I can keep only this commit

Let's consider the use-case: 1. Someone (e.g. IAM) set non-utf8 id 2. User using cli lists all policies and see policy from step 1 3. User want to delete/get policy from step 1. He needs somehow pass non-utf8 id via CLI If this isn't a case, I can keep only [this commit](https://git.frostfs.info/TrueCloudLab/frostfs-node/commit/2a1d79a37dc45c723c9edf49d2ee46084d10f5fb)

Control service lists only local overrides, IAM uses contract.

Control service lists only local overrides, IAM uses contract.

IAM uses not only contract. It sets local overrides in s3/node too

IAM uses not only contract. It sets local overrides in s3/node too
)
var removeRuleCmd = &cobra.Command{
@ -34,6 +36,15 @@ func removeRule(cmd *cobra.Command, _ []string) {
cnr.Encode(rawCID)
chainID, _ := cmd.Flags().GetString(chainIDFlag)
hexEncoded, _ := cmd.Flags().GetBool(chainIDHexFlag)
chainIDRaw := []byte(chainID)
if hexEncoded {
var err error
chainIDRaw, err = hex.DecodeString(chainID)
commonCmd.ExitOnErr(cmd, "can't decode chain ID as hex: %w", err)
}
req := &control.RemoveChainLocalOverrideRequest{
Body: &control.RemoveChainLocalOverrideRequest_Body{
@ -41,7 +52,7 @@ func removeRule(cmd *cobra.Command, _ []string) {
Name: cidStr,
Type: control.ChainTarget_CONTAINER,
},
ChainId: chainID,
ChainId: chainIDRaw,
},
}
@ -72,4 +83,5 @@ func initControlRemoveRuleCmd() {
ff := removeRuleCmd.Flags()
ff.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)
ff.String(chainIDFlag, "", "Chain id")
ff.Bool(chainIDHexFlag, false, "Flag to parse chain ID as hex")
}

View file

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.2.0
// - protoc v4.25.0
// source: pkg/services/control/ir/service.proto
@ -18,13 +18,6 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
ControlService_HealthCheck_FullMethodName = "/ircontrol.ControlService/HealthCheck"
ControlService_TickEpoch_FullMethodName = "/ircontrol.ControlService/TickEpoch"
ControlService_RemoveNode_FullMethodName = "/ircontrol.ControlService/RemoveNode"
ControlService_RemoveContainer_FullMethodName = "/ircontrol.ControlService/RemoveContainer"
)
// ControlServiceClient is the client API for ControlService 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.
@ -49,7 +42,7 @@ func NewControlServiceClient(cc grpc.ClientConnInterface) ControlServiceClient {
func (c *controlServiceClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
out := new(HealthCheckResponse)
err := c.cc.Invoke(ctx, ControlService_HealthCheck_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/ircontrol.ControlService/HealthCheck", in, out, opts...)
if err != nil {
return nil, err
}
@ -58,7 +51,7 @@ func (c *controlServiceClient) HealthCheck(ctx context.Context, in *HealthCheckR
func (c *controlServiceClient) TickEpoch(ctx context.Context, in *TickEpochRequest, opts ...grpc.CallOption) (*TickEpochResponse, error) {
out := new(TickEpochResponse)
err := c.cc.Invoke(ctx, ControlService_TickEpoch_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/ircontrol.ControlService/TickEpoch", in, out, opts...)
if err != nil {
return nil, err
}
@ -67,7 +60,7 @@ func (c *controlServiceClient) TickEpoch(ctx context.Context, in *TickEpochReque
func (c *controlServiceClient) RemoveNode(ctx context.Context, in *RemoveNodeRequest, opts ...grpc.CallOption) (*RemoveNodeResponse, error) {
out := new(RemoveNodeResponse)
err := c.cc.Invoke(ctx, ControlService_RemoveNode_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/ircontrol.ControlService/RemoveNode", in, out, opts...)
if err != nil {
return nil, err
}
@ -76,7 +69,7 @@ func (c *controlServiceClient) RemoveNode(ctx context.Context, in *RemoveNodeReq
func (c *controlServiceClient) RemoveContainer(ctx context.Context, in *RemoveContainerRequest, opts ...grpc.CallOption) (*RemoveContainerResponse, error) {
out := new(RemoveContainerResponse)
err := c.cc.Invoke(ctx, ControlService_RemoveContainer_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/ircontrol.ControlService/RemoveContainer", in, out, opts...)
if err != nil {
return nil, err
}
@ -135,7 +128,7 @@ func _ControlService_HealthCheck_Handler(srv interface{}, ctx context.Context, d
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ControlService_HealthCheck_FullMethodName,
FullMethod: "/ircontrol.ControlService/HealthCheck",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServiceServer).HealthCheck(ctx, req.(*HealthCheckRequest))
@ -153,7 +146,7 @@ func _ControlService_TickEpoch_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ControlService_TickEpoch_FullMethodName,
FullMethod: "/ircontrol.ControlService/TickEpoch",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServiceServer).TickEpoch(ctx, req.(*TickEpochRequest))
@ -171,7 +164,7 @@ func _ControlService_RemoveNode_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ControlService_RemoveNode_FullMethodName,
FullMethod: "/ircontrol.ControlService/RemoveNode",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServiceServer).RemoveNode(ctx, req.(*RemoveNodeRequest))
@ -189,7 +182,7 @@ func _ControlService_RemoveContainer_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ControlService_RemoveContainer_FullMethodName,
FullMethod: "/ircontrol.ControlService/RemoveContainer",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServiceServer).RemoveContainer(ctx, req.(*RemoveContainerRequest))

View file

@ -7,7 +7,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/control"
apechain "git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain"
engine "git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine"
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
@ -51,7 +51,7 @@ func (s *Server) AddChainLocalOverride(_ context.Context, req *control.AddChainL
resp := &control.AddChainLocalOverrideResponse{
Body: &control.AddChainLocalOverrideResponse_Body{
ChainId: string(chain.ID),
ChainId: []byte(chain.ID),
},
}
err = SignMessage(s.key, resp)

View file

@ -3379,7 +3379,7 @@ type AddChainLocalOverrideResponse_Body struct {
// Chain ID assigned for the added rule chain.
// If chain ID is left empty in the request, then
// it will be generated.
ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
ChainId []byte `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (x *AddChainLocalOverrideResponse_Body) Reset() {
@ -3414,11 +3414,11 @@ func (*AddChainLocalOverrideResponse_Body) Descriptor() ([]byte, []int) {
return file_pkg_services_control_service_proto_rawDescGZIP(), []int{25, 0}
}
func (x *AddChainLocalOverrideResponse_Body) GetChainId() string {
func (x *AddChainLocalOverrideResponse_Body) GetChainId() []byte {
if x != nil {
return x.ChainId
}
return ""
return nil
}
type GetChainLocalOverrideRequest_Body struct {
@ -3429,7 +3429,7 @@ type GetChainLocalOverrideRequest_Body struct {
// Target for which the overrides are applied.
Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
// Chain ID assigned for the added rule chain.
ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
ChainId []byte `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (x *GetChainLocalOverrideRequest_Body) Reset() {
@ -3471,11 +3471,11 @@ func (x *GetChainLocalOverrideRequest_Body) GetTarget() *ChainTarget {
return nil
}
func (x *GetChainLocalOverrideRequest_Body) GetChainId() string {
func (x *GetChainLocalOverrideRequest_Body) GetChainId() []byte {
if x != nil {
return x.ChainId
}
return ""
return nil
}
type GetChainLocalOverrideResponse_Body struct {
@ -3630,7 +3630,7 @@ type RemoveChainLocalOverrideRequest_Body struct {
// Target for which the overrides are applied.
Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
// Chain ID assigned for the added rule chain.
ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
ChainId []byte `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (x *RemoveChainLocalOverrideRequest_Body) Reset() {
@ -3672,11 +3672,11 @@ func (x *RemoveChainLocalOverrideRequest_Body) GetTarget() *ChainTarget {
return nil
}
func (x *RemoveChainLocalOverrideRequest_Body) GetChainId() string {
func (x *RemoveChainLocalOverrideRequest_Body) GetChainId() []byte {
if x != nil {
return x.ChainId
}
return ""
return nil
}
type RemoveChainLocalOverrideResponse_Body struct {
@ -4222,7 +4222,7 @@ var file_pkg_services_control_service_proto_rawDesc = []byte{
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
0x6c, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67,
0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x21, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x19,
0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xe1, 0x01, 0x0a, 0x1c, 0x47, 0x65,
0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4f, 0x76, 0x65, 0x72, 0x72,
0x69, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x04, 0x62, 0x6f,
@ -4237,7 +4237,7 @@ var file_pkg_services_control_service_proto_rawDesc = []byte{
0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x43,
0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67,
0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xb0, 0x01,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xb0, 0x01,
0x0a, 0x1d, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4f,
0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e,
@ -4287,7 +4287,7 @@ var file_pkg_services_control_service_proto_rawDesc = []byte{
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
0x6c, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74,
0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64,
0x22, 0xba, 0x01, 0x0a, 0x20, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e,
0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20,

View file

@ -446,7 +446,7 @@ message AddChainLocalOverrideResponse {
// Chain ID assigned for the added rule chain.
// If chain ID is left empty in the request, then
// it will be generated.
string chain_id = 1;
bytes chain_id = 1;
}
Body body = 1;
@ -461,7 +461,7 @@ message GetChainLocalOverrideRequest {
ChainTarget target = 1;
// Chain ID assigned for the added rule chain.
string chain_id = 2;
bytes chain_id = 2;
}
Body body = 1;
@ -511,7 +511,7 @@ message RemoveChainLocalOverrideRequest {
ChainTarget target = 1;
// Chain ID assigned for the added rule chain.
string chain_id = 2;
bytes chain_id = 2;
}
Body body = 1;

View file

@ -2157,7 +2157,7 @@ func (x *AddChainLocalOverrideResponse_Body) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.StringSize(1, x.ChainId)
size += proto.BytesSize(1, x.ChainId)
return size
}
@ -2177,7 +2177,7 @@ func (x *AddChainLocalOverrideResponse_Body) StableMarshal(buf []byte) []byte {
buf = make([]byte, x.StableSize())
}
var offset int
offset += proto.StringMarshal(1, buf[offset:], x.ChainId)
offset += proto.BytesMarshal(1, buf[offset:], x.ChainId)
return buf
}
@ -2244,7 +2244,7 @@ func (x *GetChainLocalOverrideRequest_Body) StableSize() (size int) {
return 0
}
size += proto.NestedStructureSize(1, x.Target)
size += proto.StringSize(2, x.ChainId)
size += proto.BytesSize(2, x.ChainId)
return size
}
@ -2265,7 +2265,7 @@ func (x *GetChainLocalOverrideRequest_Body) StableMarshal(buf []byte) []byte {
}
var offset int
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Target)
offset += proto.StringMarshal(2, buf[offset:], x.ChainId)
offset += proto.BytesMarshal(2, buf[offset:], x.ChainId)
return buf
}
@ -2590,7 +2590,7 @@ func (x *RemoveChainLocalOverrideRequest_Body) StableSize() (size int) {
return 0
}
size += proto.NestedStructureSize(1, x.Target)
size += proto.StringSize(2, x.ChainId)
size += proto.BytesSize(2, x.ChainId)
return size
}
@ -2611,7 +2611,7 @@ func (x *RemoveChainLocalOverrideRequest_Body) StableMarshal(buf []byte) []byte
}
var offset int
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Target)
offset += proto.StringMarshal(2, buf[offset:], x.ChainId)
offset += proto.BytesMarshal(2, buf[offset:], x.ChainId)
return buf
}

View file

@ -1,9 +1,6 @@
//*
// Service for working with CRDT tree.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc-gen-go-grpc v1.2.0
// - protoc v4.25.0
// source: pkg/services/tree/service.proto
@ -21,19 +18,6 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
TreeService_Add_FullMethodName = "/tree.TreeService/Add"
TreeService_AddByPath_FullMethodName = "/tree.TreeService/AddByPath"
TreeService_Remove_FullMethodName = "/tree.TreeService/Remove"
TreeService_Move_FullMethodName = "/tree.TreeService/Move"
TreeService_GetNodeByPath_FullMethodName = "/tree.TreeService/GetNodeByPath"
TreeService_GetSubTree_FullMethodName = "/tree.TreeService/GetSubTree"
TreeService_TreeList_FullMethodName = "/tree.TreeService/TreeList"
TreeService_Apply_FullMethodName = "/tree.TreeService/Apply"
TreeService_GetOpLog_FullMethodName = "/tree.TreeService/GetOpLog"
TreeService_Healthcheck_FullMethodName = "/tree.TreeService/Healthcheck"
)
// TreeServiceClient is the client API for TreeService 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.
@ -71,7 +55,7 @@ func NewTreeServiceClient(cc grpc.ClientConnInterface) TreeServiceClient {
func (c *treeServiceClient) Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*AddResponse, error) {
out := new(AddResponse)
err := c.cc.Invoke(ctx, TreeService_Add_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/tree.TreeService/Add", in, out, opts...)
if err != nil {
return nil, err
}
@ -80,7 +64,7 @@ func (c *treeServiceClient) Add(ctx context.Context, in *AddRequest, opts ...grp
func (c *treeServiceClient) AddByPath(ctx context.Context, in *AddByPathRequest, opts ...grpc.CallOption) (*AddByPathResponse, error) {
out := new(AddByPathResponse)
err := c.cc.Invoke(ctx, TreeService_AddByPath_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/tree.TreeService/AddByPath", in, out, opts...)
if err != nil {
return nil, err
}
@ -89,7 +73,7 @@ func (c *treeServiceClient) AddByPath(ctx context.Context, in *AddByPathRequest,
func (c *treeServiceClient) Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error) {
out := new(RemoveResponse)
err := c.cc.Invoke(ctx, TreeService_Remove_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/tree.TreeService/Remove", in, out, opts...)
if err != nil {
return nil, err
}
@ -98,7 +82,7 @@ func (c *treeServiceClient) Remove(ctx context.Context, in *RemoveRequest, opts
func (c *treeServiceClient) Move(ctx context.Context, in *MoveRequest, opts ...grpc.CallOption) (*MoveResponse, error) {
out := new(MoveResponse)
err := c.cc.Invoke(ctx, TreeService_Move_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/tree.TreeService/Move", in, out, opts...)
if err != nil {
return nil, err
}
@ -107,7 +91,7 @@ func (c *treeServiceClient) Move(ctx context.Context, in *MoveRequest, opts ...g
func (c *treeServiceClient) GetNodeByPath(ctx context.Context, in *GetNodeByPathRequest, opts ...grpc.CallOption) (*GetNodeByPathResponse, error) {
out := new(GetNodeByPathResponse)
err := c.cc.Invoke(ctx, TreeService_GetNodeByPath_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/tree.TreeService/GetNodeByPath", in, out, opts...)
if err != nil {
return nil, err
}
@ -115,7 +99,7 @@ func (c *treeServiceClient) GetNodeByPath(ctx context.Context, in *GetNodeByPath
}
func (c *treeServiceClient) GetSubTree(ctx context.Context, in *GetSubTreeRequest, opts ...grpc.CallOption) (TreeService_GetSubTreeClient, error) {
stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[0], TreeService_GetSubTree_FullMethodName, opts...)
stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[0], "/tree.TreeService/GetSubTree", opts...)
if err != nil {
return nil, err
}
@ -148,7 +132,7 @@ func (x *treeServiceGetSubTreeClient) Recv() (*GetSubTreeResponse, error) {
func (c *treeServiceClient) TreeList(ctx context.Context, in *TreeListRequest, opts ...grpc.CallOption) (*TreeListResponse, error) {
out := new(TreeListResponse)
err := c.cc.Invoke(ctx, TreeService_TreeList_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/tree.TreeService/TreeList", in, out, opts...)
if err != nil {
return nil, err
}
@ -157,7 +141,7 @@ func (c *treeServiceClient) TreeList(ctx context.Context, in *TreeListRequest, o
func (c *treeServiceClient) Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResponse, error) {
out := new(ApplyResponse)
err := c.cc.Invoke(ctx, TreeService_Apply_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/tree.TreeService/Apply", in, out, opts...)
if err != nil {
return nil, err
}
@ -165,7 +149,7 @@ func (c *treeServiceClient) Apply(ctx context.Context, in *ApplyRequest, opts ..
}
func (c *treeServiceClient) GetOpLog(ctx context.Context, in *GetOpLogRequest, opts ...grpc.CallOption) (TreeService_GetOpLogClient, error) {
stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[1], TreeService_GetOpLog_FullMethodName, opts...)
stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[1], "/tree.TreeService/GetOpLog", opts...)
if err != nil {
return nil, err
}
@ -198,7 +182,7 @@ func (x *treeServiceGetOpLogClient) Recv() (*GetOpLogResponse, error) {
func (c *treeServiceClient) Healthcheck(ctx context.Context, in *HealthcheckRequest, opts ...grpc.CallOption) (*HealthcheckResponse, error) {
out := new(HealthcheckResponse)
err := c.cc.Invoke(ctx, TreeService_Healthcheck_FullMethodName, in, out, opts...)
err := c.cc.Invoke(ctx, "/tree.TreeService/Healthcheck", in, out, opts...)
if err != nil {
return nil, err
}
@ -288,7 +272,7 @@ func _TreeService_Add_Handler(srv interface{}, ctx context.Context, dec func(int
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TreeService_Add_FullMethodName,
FullMethod: "/tree.TreeService/Add",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TreeServiceServer).Add(ctx, req.(*AddRequest))
@ -306,7 +290,7 @@ func _TreeService_AddByPath_Handler(srv interface{}, ctx context.Context, dec fu
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TreeService_AddByPath_FullMethodName,
FullMethod: "/tree.TreeService/AddByPath",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TreeServiceServer).AddByPath(ctx, req.(*AddByPathRequest))
@ -324,7 +308,7 @@ func _TreeService_Remove_Handler(srv interface{}, ctx context.Context, dec func(
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TreeService_Remove_FullMethodName,
FullMethod: "/tree.TreeService/Remove",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TreeServiceServer).Remove(ctx, req.(*RemoveRequest))
@ -342,7 +326,7 @@ func _TreeService_Move_Handler(srv interface{}, ctx context.Context, dec func(in
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TreeService_Move_FullMethodName,
FullMethod: "/tree.TreeService/Move",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TreeServiceServer).Move(ctx, req.(*MoveRequest))
@ -360,7 +344,7 @@ func _TreeService_GetNodeByPath_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TreeService_GetNodeByPath_FullMethodName,
FullMethod: "/tree.TreeService/GetNodeByPath",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TreeServiceServer).GetNodeByPath(ctx, req.(*GetNodeByPathRequest))
@ -399,7 +383,7 @@ func _TreeService_TreeList_Handler(srv interface{}, ctx context.Context, dec fun
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TreeService_TreeList_FullMethodName,
FullMethod: "/tree.TreeService/TreeList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TreeServiceServer).TreeList(ctx, req.(*TreeListRequest))
@ -417,7 +401,7 @@ func _TreeService_Apply_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TreeService_Apply_FullMethodName,
FullMethod: "/tree.TreeService/Apply",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TreeServiceServer).Apply(ctx, req.(*ApplyRequest))
@ -456,7 +440,7 @@ func _TreeService_Healthcheck_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TreeService_Healthcheck_FullMethodName,
FullMethod: "/tree.TreeService/Healthcheck",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TreeServiceServer).Healthcheck(ctx, req.(*HealthcheckRequest))