Compare commits

..

1 commit

Author SHA1 Message Date
2282032c9b [#XX] patcher: Add closer
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-11-27 13:22:13 +03:00
151 changed files with 37754 additions and 54079 deletions

View file

@ -1,22 +0,0 @@
name: Code generation
on: [pull_request]
jobs:
wrappers:
name: Generate proto
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.23'
- name: Generate proto
run: make protoc
# The command seems to be non-deterministic.
# However, with >20 runs I haven't been able to reproduce the issue.
# This `git diff` is here to print diff in case we catch the behaviour again.
- name: Print diff
run: git diff HEAD
- name: Check that nothing has changed
run: git diff-index --exit-code HEAD

View file

@ -1,3 +1 @@
.* @TrueCloudLab/storage-core-committers @TrueCloudLab/storage-core-developers @TrueCloudLab/storage-services-committers @TrueCloudLab/storage-services-developers
.forgejo/.* @potyarkin
Makefile @potyarkin
.* @TrueCloudLab/storage-core @TrueCloudLab/storage-services

View file

@ -7,9 +7,8 @@ TRUECLOUDLAB_LINT_VERSION ?= 0.0.7
OUTPUT_LINT_DIR ?= $(shell pwd)/bin
LINT_DIR = $(OUTPUT_LINT_DIR)/golangci-lint-$(LINT_VERSION)-v$(TRUECLOUDLAB_LINT_VERSION)
PROTOC_VERSION ?= 29.2
PROTOC_VERSION ?= 27.2
PROTOC_GEN_GO_VERSION ?= $(shell go list -f '{{.Version}}' -m google.golang.org/protobuf)
PROTOC_GEN_GRPC_GO_VERSION ?= 1.5.1
PROTOC_OS_VERSION=osx-x86_64
ifeq ($(shell uname), Linux)
PROTOC_OS_VERSION=linux-x86_64
@ -45,8 +44,6 @@ protoc-install:
@rm $(PROTOBUF_DIR)/protoc-$(PROTOC_VERSION).zip
@echo "⇒ Installing protoc-gen-go..."
@GOBIN=$(PROTOC_GEN_GO_DIR) go install -v google.golang.org/protobuf/...@$(PROTOC_GEN_GO_VERSION)
@echo "⇒ Installing protoc-gen-go-grpc..."
@GOBIN=$(PROTOC_GEN_GO_DIR) go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@v$(PROTOC_GEN_GRPC_GO_VERSION)
# Regenerate code for proto files
@ -55,13 +52,13 @@ protoc:
make protoc-install; \
fi
# Protoc generate
@for f in `find . -type f -name '*.proto' -not -path './bin/*'`; do \
@for f in `find . -type f -name '*.proto' -not -path './bin/*' -not -path './api/util/proto/test/*'`; do \
echo "⇒ Processing $$f "; \
$(PROTOC_DIR)/bin/protoc \
--plugin=protoc-gen-go=$(PROTOC_GEN_GO_DIR)/protoc-gen-go \
--plugin=protoc-gen-go-grpc=$(PROTOC_GEN_GO_DIR)/protoc-gen-go-grpc \
--go_out=. --go_opt=paths=source_relative \
--go_opt=default_api_level=API_HYBRID \
--proto_path=.:$(PROTOC_DIR)/include:/usr/local/include \
--plugin=protoc-gen-go-frostfs=$(abspath ./bin/protogen) \
--go-frostfs_out=fuzz=true:. \
--go-frostfs_opt=paths=source_relative \
--go-grpc_opt=require_unimplemented_servers=false \
--go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \
done

View file

@ -1,559 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/accounting/grpc/service.proto
//go:build !protoopaque
package accounting
import (
grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// BalanceRequest message
type BalanceRequest struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Body of the balance request message.
Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"`
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"`
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BalanceRequest) Reset() {
*x = BalanceRequest{}
mi := &file_api_accounting_grpc_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BalanceRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceRequest) ProtoMessage() {}
func (x *BalanceRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *BalanceRequest) GetBody() *BalanceRequest_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *BalanceRequest) GetMetaHeader() *grpc.RequestMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *BalanceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
func (x *BalanceRequest) SetBody(v *BalanceRequest_Body) {
x.Body = v
}
func (x *BalanceRequest) SetMetaHeader(v *grpc.RequestMetaHeader) {
x.MetaHeader = v
}
func (x *BalanceRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) {
x.VerifyHeader = v
}
func (x *BalanceRequest) HasBody() bool {
if x == nil {
return false
}
return x.Body != nil
}
func (x *BalanceRequest) HasMetaHeader() bool {
if x == nil {
return false
}
return x.MetaHeader != nil
}
func (x *BalanceRequest) HasVerifyHeader() bool {
if x == nil {
return false
}
return x.VerifyHeader != nil
}
func (x *BalanceRequest) ClearBody() {
x.Body = nil
}
func (x *BalanceRequest) ClearMetaHeader() {
x.MetaHeader = nil
}
func (x *BalanceRequest) ClearVerifyHeader() {
x.VerifyHeader = nil
}
type BalanceRequest_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Body of the balance request message.
Body *BalanceRequest_Body
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *grpc.RequestMetaHeader
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.RequestVerificationHeader
}
func (b0 BalanceRequest_builder) Build() *BalanceRequest {
m0 := &BalanceRequest{}
b, x := &b0, m0
_, _ = b, x
x.Body = b.Body
x.MetaHeader = b.MetaHeader
x.VerifyHeader = b.VerifyHeader
return m0
}
// BalanceResponse message
type BalanceResponse struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Body of the balance response message.
Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"`
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"`
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BalanceResponse) Reset() {
*x = BalanceResponse{}
mi := &file_api_accounting_grpc_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BalanceResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceResponse) ProtoMessage() {}
func (x *BalanceResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *BalanceResponse) GetBody() *BalanceResponse_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *BalanceResponse) GetMetaHeader() *grpc.ResponseMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *BalanceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
func (x *BalanceResponse) SetBody(v *BalanceResponse_Body) {
x.Body = v
}
func (x *BalanceResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) {
x.MetaHeader = v
}
func (x *BalanceResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) {
x.VerifyHeader = v
}
func (x *BalanceResponse) HasBody() bool {
if x == nil {
return false
}
return x.Body != nil
}
func (x *BalanceResponse) HasMetaHeader() bool {
if x == nil {
return false
}
return x.MetaHeader != nil
}
func (x *BalanceResponse) HasVerifyHeader() bool {
if x == nil {
return false
}
return x.VerifyHeader != nil
}
func (x *BalanceResponse) ClearBody() {
x.Body = nil
}
func (x *BalanceResponse) ClearMetaHeader() {
x.MetaHeader = nil
}
func (x *BalanceResponse) ClearVerifyHeader() {
x.VerifyHeader = nil
}
type BalanceResponse_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Body of the balance response message.
Body *BalanceResponse_Body
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *grpc.ResponseMetaHeader
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.ResponseVerificationHeader
}
func (b0 BalanceResponse_builder) Build() *BalanceResponse {
m0 := &BalanceResponse{}
b, x := &b0, m0
_, _ = b, x
x.Body = b.Body
x.MetaHeader = b.MetaHeader
x.VerifyHeader = b.VerifyHeader
return m0
}
// To indicate the account for which the balance is requested, its identifier
// is used. It can be any existing account in FrostFS sidechain `Balance`
// smart contract. If omitted, client implementation MUST set it to the
// request's signer `OwnerID`.
type BalanceRequest_Body struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Valid user identifier in `OwnerID` format for which the balance is
// requested. Required field.
OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BalanceRequest_Body) Reset() {
*x = BalanceRequest_Body{}
mi := &file_api_accounting_grpc_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BalanceRequest_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceRequest_Body) ProtoMessage() {}
func (x *BalanceRequest_Body) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID {
if x != nil {
return x.OwnerId
}
return nil
}
func (x *BalanceRequest_Body) SetOwnerId(v *grpc1.OwnerID) {
x.OwnerId = v
}
func (x *BalanceRequest_Body) HasOwnerId() bool {
if x == nil {
return false
}
return x.OwnerId != nil
}
func (x *BalanceRequest_Body) ClearOwnerId() {
x.OwnerId = nil
}
type BalanceRequest_Body_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Valid user identifier in `OwnerID` format for which the balance is
// requested. Required field.
OwnerId *grpc1.OwnerID
}
func (b0 BalanceRequest_Body_builder) Build() *BalanceRequest_Body {
m0 := &BalanceRequest_Body{}
b, x := &b0, m0
_, _ = b, x
x.OwnerId = b.OwnerId
return m0
}
// The amount of funds in GAS token for the `OwnerID`'s account requested.
// Balance is given in the `Decimal` format to avoid precision issues with
// rounding.
type BalanceResponse_Body struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Amount of funds in GAS token for the requested account.
Balance *Decimal `protobuf:"bytes,1,opt,name=balance" json:"balance,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BalanceResponse_Body) Reset() {
*x = BalanceResponse_Body{}
mi := &file_api_accounting_grpc_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BalanceResponse_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceResponse_Body) ProtoMessage() {}
func (x *BalanceResponse_Body) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *BalanceResponse_Body) GetBalance() *Decimal {
if x != nil {
return x.Balance
}
return nil
}
func (x *BalanceResponse_Body) SetBalance(v *Decimal) {
x.Balance = v
}
func (x *BalanceResponse_Body) HasBalance() bool {
if x == nil {
return false
}
return x.Balance != nil
}
func (x *BalanceResponse_Body) ClearBalance() {
x.Balance = nil
}
type BalanceResponse_Body_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Amount of funds in GAS token for the requested account.
Balance *Decimal
}
func (b0 BalanceResponse_Body_builder) Build() *BalanceResponse_Body {
m0 := &BalanceResponse_Body{}
b, x := &b0, m0
_, _ = b, x
x.Balance = b.Balance
return m0
}
var File_api_accounting_grpc_service_proto protoreflect.FileDescriptor
var file_api_accounting_grpc_service_proto_rawDesc = []byte{
0x0a, 0x21, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x1a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x61,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74,
0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f,
0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xa5, 0x02, 0x0a, 0x0e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61,
0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52,
0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d,
0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56,
0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65,
0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a,
0x3a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72,
0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xae, 0x02, 0x0a, 0x0f,
0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e,
0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12,
0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74,
0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66,
0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d,
0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76,
0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3f, 0x0a, 0x04, 0x42,
0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x44, 0x65, 0x63, 0x69,
0x6d, 0x61, 0x6c, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x32, 0x6b, 0x0a, 0x11,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x56, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x24, 0x2e, 0x6e,
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6e, 0x5a, 0x4b, 0x67, 0x69, 0x74,
0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72,
0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74,
0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46,
0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var file_api_accounting_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_api_accounting_grpc_service_proto_goTypes = []any{
(*BalanceRequest)(nil), // 0: neo.fs.v2.accounting.BalanceRequest
(*BalanceResponse)(nil), // 1: neo.fs.v2.accounting.BalanceResponse
(*BalanceRequest_Body)(nil), // 2: neo.fs.v2.accounting.BalanceRequest.Body
(*BalanceResponse_Body)(nil), // 3: neo.fs.v2.accounting.BalanceResponse.Body
(*grpc.RequestMetaHeader)(nil), // 4: neo.fs.v2.session.RequestMetaHeader
(*grpc.RequestVerificationHeader)(nil), // 5: neo.fs.v2.session.RequestVerificationHeader
(*grpc.ResponseMetaHeader)(nil), // 6: neo.fs.v2.session.ResponseMetaHeader
(*grpc.ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader
(*grpc1.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID
(*Decimal)(nil), // 9: neo.fs.v2.accounting.Decimal
}
var file_api_accounting_grpc_service_proto_depIdxs = []int32{
2, // 0: neo.fs.v2.accounting.BalanceRequest.body:type_name -> neo.fs.v2.accounting.BalanceRequest.Body
4, // 1: neo.fs.v2.accounting.BalanceRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader
5, // 2: neo.fs.v2.accounting.BalanceRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader
3, // 3: neo.fs.v2.accounting.BalanceResponse.body:type_name -> neo.fs.v2.accounting.BalanceResponse.Body
6, // 4: neo.fs.v2.accounting.BalanceResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader
7, // 5: neo.fs.v2.accounting.BalanceResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader
8, // 6: neo.fs.v2.accounting.BalanceRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID
9, // 7: neo.fs.v2.accounting.BalanceResponse.Body.balance:type_name -> neo.fs.v2.accounting.Decimal
0, // 8: neo.fs.v2.accounting.AccountingService.Balance:input_type -> neo.fs.v2.accounting.BalanceRequest
1, // 9: neo.fs.v2.accounting.AccountingService.Balance:output_type -> neo.fs.v2.accounting.BalanceResponse
9, // [9:10] is the sub-list for method output_type
8, // [8:9] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_api_accounting_grpc_service_proto_init() }
func file_api_accounting_grpc_service_proto_init() {
if File_api_accounting_grpc_service_proto != nil {
return
}
file_api_accounting_grpc_types_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_accounting_grpc_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_api_accounting_grpc_service_proto_goTypes,
DependencyIndexes: file_api_accounting_grpc_service_proto_depIdxs,
MessageInfos: file_api_accounting_grpc_service_proto_msgTypes,
}.Build()
File_api_accounting_grpc_service_proto = out.File
file_api_accounting_grpc_service_proto_rawDesc = nil
file_api_accounting_grpc_service_proto_goTypes = nil
file_api_accounting_grpc_service_proto_depIdxs = nil
}

768
api/accounting/grpc/service_frostfs.pb.go generated Normal file
View file

@ -0,0 +1,768 @@
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
import (
json "encoding/json"
fmt "fmt"
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc"
pool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool"
proto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto"
encoding "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding"
easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
type BalanceRequest_Body struct {
OwnerId *grpc.OwnerID `json:"ownerId"`
}
var (
_ encoding.ProtoMarshaler = (*BalanceRequest_Body)(nil)
_ encoding.ProtoUnmarshaler = (*BalanceRequest_Body)(nil)
_ json.Marshaler = (*BalanceRequest_Body)(nil)
_ json.Unmarshaler = (*BalanceRequest_Body)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *BalanceRequest_Body) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.NestedStructureSize(1, x.OwnerId)
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *BalanceRequest_Body) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *BalanceRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if x.OwnerId != nil {
x.OwnerId.EmitProtobuf(mm.AppendMessage(1))
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *BalanceRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "BalanceRequest_Body")
}
switch fc.FieldNum {
case 1: // OwnerId
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "OwnerId")
}
x.OwnerId = new(grpc.OwnerID)
if err := x.OwnerId.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
}
}
return nil
}
func (x *BalanceRequest_Body) GetOwnerId() *grpc.OwnerID {
if x != nil {
return x.OwnerId
}
return nil
}
func (x *BalanceRequest_Body) SetOwnerId(v *grpc.OwnerID) {
x.OwnerId = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *BalanceRequest_Body) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *BalanceRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerId\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *BalanceRequest_Body) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *BalanceRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "ownerId":
{
var f *grpc.OwnerID
f = new(grpc.OwnerID)
f.UnmarshalEasyJSON(in)
x.OwnerId = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
type BalanceRequest struct {
Body *BalanceRequest_Body `json:"body"`
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
}
var (
_ encoding.ProtoMarshaler = (*BalanceRequest)(nil)
_ encoding.ProtoUnmarshaler = (*BalanceRequest)(nil)
_ json.Marshaler = (*BalanceRequest)(nil)
_ json.Unmarshaler = (*BalanceRequest)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *BalanceRequest) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.NestedStructureSize(1, x.Body)
size += proto.NestedStructureSize(2, x.MetaHeader)
size += proto.NestedStructureSize(3, x.VerifyHeader)
return size
}
// ReadSignedData fills buf with signed data of x.
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
//
// Returns any error encountered which did not allow writing the data completely.
// Otherwise, returns the buffer in which the data is written.
//
// Structures with the same field values have the same signed data.
func (x *BalanceRequest) SignedDataSize() int {
return x.GetBody().StableSize()
}
// SignedDataSize returns size of the request signed data in bytes.
//
// Structures with the same field values have the same signed data size.
func (x *BalanceRequest) ReadSignedData(buf []byte) ([]byte, error) {
return x.GetBody().MarshalProtobuf(buf), nil
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *BalanceRequest) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *BalanceRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if x.Body != nil {
x.Body.EmitProtobuf(mm.AppendMessage(1))
}
if x.MetaHeader != nil {
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
}
if x.VerifyHeader != nil {
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *BalanceRequest) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "BalanceRequest")
}
switch fc.FieldNum {
case 1: // Body
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Body")
}
x.Body = new(BalanceRequest_Body)
if err := x.Body.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 2: // MetaHeader
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
}
x.MetaHeader = new(grpc1.RequestMetaHeader)
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 3: // VerifyHeader
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
}
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
}
}
return nil
}
func (x *BalanceRequest) GetBody() *BalanceRequest_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *BalanceRequest) SetBody(v *BalanceRequest_Body) {
x.Body = v
}
func (x *BalanceRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *BalanceRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
x.MetaHeader = v
}
func (x *BalanceRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
func (x *BalanceRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
x.VerifyHeader = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *BalanceRequest) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *BalanceRequest) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *BalanceRequest) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *BalanceRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "body":
{
var f *BalanceRequest_Body
f = new(BalanceRequest_Body)
f.UnmarshalEasyJSON(in)
x.Body = f
}
case "metaHeader":
{
var f *grpc1.RequestMetaHeader
f = new(grpc1.RequestMetaHeader)
f.UnmarshalEasyJSON(in)
x.MetaHeader = f
}
case "verifyHeader":
{
var f *grpc1.RequestVerificationHeader
f = new(grpc1.RequestVerificationHeader)
f.UnmarshalEasyJSON(in)
x.VerifyHeader = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
type BalanceResponse_Body struct {
Balance *Decimal `json:"balance"`
}
var (
_ encoding.ProtoMarshaler = (*BalanceResponse_Body)(nil)
_ encoding.ProtoUnmarshaler = (*BalanceResponse_Body)(nil)
_ json.Marshaler = (*BalanceResponse_Body)(nil)
_ json.Unmarshaler = (*BalanceResponse_Body)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *BalanceResponse_Body) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.NestedStructureSize(1, x.Balance)
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *BalanceResponse_Body) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *BalanceResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if x.Balance != nil {
x.Balance.EmitProtobuf(mm.AppendMessage(1))
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *BalanceResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "BalanceResponse_Body")
}
switch fc.FieldNum {
case 1: // Balance
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Balance")
}
x.Balance = new(Decimal)
if err := x.Balance.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
}
}
return nil
}
func (x *BalanceResponse_Body) GetBalance() *Decimal {
if x != nil {
return x.Balance
}
return nil
}
func (x *BalanceResponse_Body) SetBalance(v *Decimal) {
x.Balance = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *BalanceResponse_Body) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *BalanceResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"balance\":"
out.RawString(prefix)
x.Balance.MarshalEasyJSON(out)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *BalanceResponse_Body) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *BalanceResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "balance":
{
var f *Decimal
f = new(Decimal)
f.UnmarshalEasyJSON(in)
x.Balance = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
type BalanceResponse struct {
Body *BalanceResponse_Body `json:"body"`
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
}
var (
_ encoding.ProtoMarshaler = (*BalanceResponse)(nil)
_ encoding.ProtoUnmarshaler = (*BalanceResponse)(nil)
_ json.Marshaler = (*BalanceResponse)(nil)
_ json.Unmarshaler = (*BalanceResponse)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *BalanceResponse) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.NestedStructureSize(1, x.Body)
size += proto.NestedStructureSize(2, x.MetaHeader)
size += proto.NestedStructureSize(3, x.VerifyHeader)
return size
}
// ReadSignedData fills buf with signed data of x.
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
//
// Returns any error encountered which did not allow writing the data completely.
// Otherwise, returns the buffer in which the data is written.
//
// Structures with the same field values have the same signed data.
func (x *BalanceResponse) SignedDataSize() int {
return x.GetBody().StableSize()
}
// SignedDataSize returns size of the request signed data in bytes.
//
// Structures with the same field values have the same signed data size.
func (x *BalanceResponse) ReadSignedData(buf []byte) ([]byte, error) {
return x.GetBody().MarshalProtobuf(buf), nil
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *BalanceResponse) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *BalanceResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if x.Body != nil {
x.Body.EmitProtobuf(mm.AppendMessage(1))
}
if x.MetaHeader != nil {
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
}
if x.VerifyHeader != nil {
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *BalanceResponse) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "BalanceResponse")
}
switch fc.FieldNum {
case 1: // Body
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Body")
}
x.Body = new(BalanceResponse_Body)
if err := x.Body.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 2: // MetaHeader
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
}
x.MetaHeader = new(grpc1.ResponseMetaHeader)
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 3: // VerifyHeader
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
}
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
}
}
return nil
}
func (x *BalanceResponse) GetBody() *BalanceResponse_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *BalanceResponse) SetBody(v *BalanceResponse_Body) {
x.Body = v
}
func (x *BalanceResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *BalanceResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
x.MetaHeader = v
}
func (x *BalanceResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
func (x *BalanceResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
x.VerifyHeader = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *BalanceResponse) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *BalanceResponse) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *BalanceResponse) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *BalanceResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "body":
{
var f *BalanceResponse_Body
f = new(BalanceResponse_Body)
f.UnmarshalEasyJSON(in)
x.Body = f
}
case "metaHeader":
{
var f *grpc1.ResponseMetaHeader
f = new(grpc1.ResponseMetaHeader)
f.UnmarshalEasyJSON(in)
x.MetaHeader = f
}
case "verifyHeader":
{
var f *grpc1.ResponseVerificationHeader
f = new(grpc1.ResponseVerificationHeader)
f.UnmarshalEasyJSON(in)
x.VerifyHeader = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}

View file

@ -0,0 +1,45 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
func DoFuzzProtoBalanceRequest(data []byte) int {
msg := new(BalanceRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONBalanceRequest(data []byte) int {
msg := new(BalanceRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoBalanceResponse(data []byte) int {
msg := new(BalanceResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONBalanceResponse(data []byte) int {
msg := new(BalanceResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,31 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
import (
testing "testing"
)
func FuzzProtoBalanceRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoBalanceRequest(data)
})
}
func FuzzJSONBalanceRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONBalanceRequest(data)
})
}
func FuzzProtoBalanceResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoBalanceResponse(data)
})
}
func FuzzJSONBalanceResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONBalanceResponse(data)
})
}

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.29.2
// - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.2
// source: api/accounting/grpc/service.proto
package accounting
@ -15,8 +15,8 @@ import (
// 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
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
AccountingService_Balance_FullMethodName = "/neo.fs.v2.accounting.AccountingService/Balance"
@ -25,12 +25,6 @@ const (
// AccountingServiceClient is the client API for AccountingService 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.
//
// Accounting service provides methods for interaction with FrostFS sidechain
// via other FrostFS nodes to get information about the account balance. Deposit
// and Withdraw operations can't be implemented here, as they require Mainnet
// FrostFS smart contract invocation. Transfer operations between internal
// FrostFS accounts are possible if both use the same token type.
type AccountingServiceClient interface {
// Returns the amount of funds in GAS token for the requested FrostFS account.
//
@ -50,9 +44,8 @@ func NewAccountingServiceClient(cc grpc.ClientConnInterface) AccountingServiceCl
}
func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceRequest, opts ...grpc.CallOption) (*BalanceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(BalanceResponse)
err := c.cc.Invoke(ctx, AccountingService_Balance_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, AccountingService_Balance_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -61,13 +54,7 @@ func (c *accountingServiceClient) Balance(ctx context.Context, in *BalanceReques
// AccountingServiceServer is the server API for AccountingService service.
// All implementations should embed UnimplementedAccountingServiceServer
// for forward compatibility.
//
// Accounting service provides methods for interaction with FrostFS sidechain
// via other FrostFS nodes to get information about the account balance. Deposit
// and Withdraw operations can't be implemented here, as they require Mainnet
// FrostFS smart contract invocation. Transfer operations between internal
// FrostFS accounts are possible if both use the same token type.
// for forward compatibility
type AccountingServiceServer interface {
// Returns the amount of funds in GAS token for the requested FrostFS account.
//
@ -78,17 +65,13 @@ type AccountingServiceServer interface {
Balance(context.Context, *BalanceRequest) (*BalanceResponse, error)
}
// UnimplementedAccountingServiceServer should 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 UnimplementedAccountingServiceServer struct{}
// UnimplementedAccountingServiceServer should be embedded to have forward compatible implementations.
type UnimplementedAccountingServiceServer struct {
}
func (UnimplementedAccountingServiceServer) Balance(context.Context, *BalanceRequest) (*BalanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented")
}
func (UnimplementedAccountingServiceServer) testEmbeddedByValue() {}
// UnsafeAccountingServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AccountingServiceServer will
@ -98,13 +81,6 @@ type UnsafeAccountingServiceServer interface {
}
func RegisterAccountingServiceServer(s grpc.ServiceRegistrar, srv AccountingServiceServer) {
// If the following call pancis, it indicates UnimplementedAccountingServiceServer 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(&AccountingService_ServiceDesc, srv)
}

View file

@ -1,544 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/accounting/grpc/service.proto
//go:build protoopaque
package accounting
import (
grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/grpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// BalanceRequest message
type BalanceRequest struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Body *BalanceRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"`
xxx_hidden_MetaHeader *grpc.RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"`
xxx_hidden_VerifyHeader *grpc.RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BalanceRequest) Reset() {
*x = BalanceRequest{}
mi := &file_api_accounting_grpc_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BalanceRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceRequest) ProtoMessage() {}
func (x *BalanceRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *BalanceRequest) GetBody() *BalanceRequest_Body {
if x != nil {
return x.xxx_hidden_Body
}
return nil
}
func (x *BalanceRequest) GetMetaHeader() *grpc.RequestMetaHeader {
if x != nil {
return x.xxx_hidden_MetaHeader
}
return nil
}
func (x *BalanceRequest) GetVerifyHeader() *grpc.RequestVerificationHeader {
if x != nil {
return x.xxx_hidden_VerifyHeader
}
return nil
}
func (x *BalanceRequest) SetBody(v *BalanceRequest_Body) {
x.xxx_hidden_Body = v
}
func (x *BalanceRequest) SetMetaHeader(v *grpc.RequestMetaHeader) {
x.xxx_hidden_MetaHeader = v
}
func (x *BalanceRequest) SetVerifyHeader(v *grpc.RequestVerificationHeader) {
x.xxx_hidden_VerifyHeader = v
}
func (x *BalanceRequest) HasBody() bool {
if x == nil {
return false
}
return x.xxx_hidden_Body != nil
}
func (x *BalanceRequest) HasMetaHeader() bool {
if x == nil {
return false
}
return x.xxx_hidden_MetaHeader != nil
}
func (x *BalanceRequest) HasVerifyHeader() bool {
if x == nil {
return false
}
return x.xxx_hidden_VerifyHeader != nil
}
func (x *BalanceRequest) ClearBody() {
x.xxx_hidden_Body = nil
}
func (x *BalanceRequest) ClearMetaHeader() {
x.xxx_hidden_MetaHeader = nil
}
func (x *BalanceRequest) ClearVerifyHeader() {
x.xxx_hidden_VerifyHeader = nil
}
type BalanceRequest_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Body of the balance request message.
Body *BalanceRequest_Body
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *grpc.RequestMetaHeader
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.RequestVerificationHeader
}
func (b0 BalanceRequest_builder) Build() *BalanceRequest {
m0 := &BalanceRequest{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Body = b.Body
x.xxx_hidden_MetaHeader = b.MetaHeader
x.xxx_hidden_VerifyHeader = b.VerifyHeader
return m0
}
// BalanceResponse message
type BalanceResponse struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Body *BalanceResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"`
xxx_hidden_MetaHeader *grpc.ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"`
xxx_hidden_VerifyHeader *grpc.ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BalanceResponse) Reset() {
*x = BalanceResponse{}
mi := &file_api_accounting_grpc_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BalanceResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceResponse) ProtoMessage() {}
func (x *BalanceResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *BalanceResponse) GetBody() *BalanceResponse_Body {
if x != nil {
return x.xxx_hidden_Body
}
return nil
}
func (x *BalanceResponse) GetMetaHeader() *grpc.ResponseMetaHeader {
if x != nil {
return x.xxx_hidden_MetaHeader
}
return nil
}
func (x *BalanceResponse) GetVerifyHeader() *grpc.ResponseVerificationHeader {
if x != nil {
return x.xxx_hidden_VerifyHeader
}
return nil
}
func (x *BalanceResponse) SetBody(v *BalanceResponse_Body) {
x.xxx_hidden_Body = v
}
func (x *BalanceResponse) SetMetaHeader(v *grpc.ResponseMetaHeader) {
x.xxx_hidden_MetaHeader = v
}
func (x *BalanceResponse) SetVerifyHeader(v *grpc.ResponseVerificationHeader) {
x.xxx_hidden_VerifyHeader = v
}
func (x *BalanceResponse) HasBody() bool {
if x == nil {
return false
}
return x.xxx_hidden_Body != nil
}
func (x *BalanceResponse) HasMetaHeader() bool {
if x == nil {
return false
}
return x.xxx_hidden_MetaHeader != nil
}
func (x *BalanceResponse) HasVerifyHeader() bool {
if x == nil {
return false
}
return x.xxx_hidden_VerifyHeader != nil
}
func (x *BalanceResponse) ClearBody() {
x.xxx_hidden_Body = nil
}
func (x *BalanceResponse) ClearMetaHeader() {
x.xxx_hidden_MetaHeader = nil
}
func (x *BalanceResponse) ClearVerifyHeader() {
x.xxx_hidden_VerifyHeader = nil
}
type BalanceResponse_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Body of the balance response message.
Body *BalanceResponse_Body
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *grpc.ResponseMetaHeader
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *grpc.ResponseVerificationHeader
}
func (b0 BalanceResponse_builder) Build() *BalanceResponse {
m0 := &BalanceResponse{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Body = b.Body
x.xxx_hidden_MetaHeader = b.MetaHeader
x.xxx_hidden_VerifyHeader = b.VerifyHeader
return m0
}
// To indicate the account for which the balance is requested, its identifier
// is used. It can be any existing account in FrostFS sidechain `Balance`
// smart contract. If omitted, client implementation MUST set it to the
// request's signer `OwnerID`.
type BalanceRequest_Body struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_OwnerId *grpc1.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BalanceRequest_Body) Reset() {
*x = BalanceRequest_Body{}
mi := &file_api_accounting_grpc_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BalanceRequest_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceRequest_Body) ProtoMessage() {}
func (x *BalanceRequest_Body) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *BalanceRequest_Body) GetOwnerId() *grpc1.OwnerID {
if x != nil {
return x.xxx_hidden_OwnerId
}
return nil
}
func (x *BalanceRequest_Body) SetOwnerId(v *grpc1.OwnerID) {
x.xxx_hidden_OwnerId = v
}
func (x *BalanceRequest_Body) HasOwnerId() bool {
if x == nil {
return false
}
return x.xxx_hidden_OwnerId != nil
}
func (x *BalanceRequest_Body) ClearOwnerId() {
x.xxx_hidden_OwnerId = nil
}
type BalanceRequest_Body_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Valid user identifier in `OwnerID` format for which the balance is
// requested. Required field.
OwnerId *grpc1.OwnerID
}
func (b0 BalanceRequest_Body_builder) Build() *BalanceRequest_Body {
m0 := &BalanceRequest_Body{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_OwnerId = b.OwnerId
return m0
}
// The amount of funds in GAS token for the `OwnerID`'s account requested.
// Balance is given in the `Decimal` format to avoid precision issues with
// rounding.
type BalanceResponse_Body struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Balance *Decimal `protobuf:"bytes,1,opt,name=balance" json:"balance,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BalanceResponse_Body) Reset() {
*x = BalanceResponse_Body{}
mi := &file_api_accounting_grpc_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BalanceResponse_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BalanceResponse_Body) ProtoMessage() {}
func (x *BalanceResponse_Body) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *BalanceResponse_Body) GetBalance() *Decimal {
if x != nil {
return x.xxx_hidden_Balance
}
return nil
}
func (x *BalanceResponse_Body) SetBalance(v *Decimal) {
x.xxx_hidden_Balance = v
}
func (x *BalanceResponse_Body) HasBalance() bool {
if x == nil {
return false
}
return x.xxx_hidden_Balance != nil
}
func (x *BalanceResponse_Body) ClearBalance() {
x.xxx_hidden_Balance = nil
}
type BalanceResponse_Body_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Amount of funds in GAS token for the requested account.
Balance *Decimal
}
func (b0 BalanceResponse_Body_builder) Build() *BalanceResponse_Body {
m0 := &BalanceResponse_Body{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Balance = b.Balance
return m0
}
var File_api_accounting_grpc_service_proto protoreflect.FileDescriptor
var file_api_accounting_grpc_service_proto_rawDesc = []byte{
0x0a, 0x21, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x1a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x61,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74,
0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f,
0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xa5, 0x02, 0x0a, 0x0e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61,
0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52,
0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d,
0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56,
0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65,
0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a,
0x3a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72,
0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0xae, 0x02, 0x0a, 0x0f,
0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x3e, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e,
0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12,
0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74,
0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66,
0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d,
0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76,
0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3f, 0x0a, 0x04, 0x42,
0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x44, 0x65, 0x63, 0x69,
0x6d, 0x61, 0x6c, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x32, 0x6b, 0x0a, 0x11,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x56, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x24, 0x2e, 0x6e,
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6e, 0x5a, 0x4b, 0x67, 0x69, 0x74,
0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72,
0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74,
0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46,
0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var file_api_accounting_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_api_accounting_grpc_service_proto_goTypes = []any{
(*BalanceRequest)(nil), // 0: neo.fs.v2.accounting.BalanceRequest
(*BalanceResponse)(nil), // 1: neo.fs.v2.accounting.BalanceResponse
(*BalanceRequest_Body)(nil), // 2: neo.fs.v2.accounting.BalanceRequest.Body
(*BalanceResponse_Body)(nil), // 3: neo.fs.v2.accounting.BalanceResponse.Body
(*grpc.RequestMetaHeader)(nil), // 4: neo.fs.v2.session.RequestMetaHeader
(*grpc.RequestVerificationHeader)(nil), // 5: neo.fs.v2.session.RequestVerificationHeader
(*grpc.ResponseMetaHeader)(nil), // 6: neo.fs.v2.session.ResponseMetaHeader
(*grpc.ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader
(*grpc1.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID
(*Decimal)(nil), // 9: neo.fs.v2.accounting.Decimal
}
var file_api_accounting_grpc_service_proto_depIdxs = []int32{
2, // 0: neo.fs.v2.accounting.BalanceRequest.body:type_name -> neo.fs.v2.accounting.BalanceRequest.Body
4, // 1: neo.fs.v2.accounting.BalanceRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader
5, // 2: neo.fs.v2.accounting.BalanceRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader
3, // 3: neo.fs.v2.accounting.BalanceResponse.body:type_name -> neo.fs.v2.accounting.BalanceResponse.Body
6, // 4: neo.fs.v2.accounting.BalanceResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader
7, // 5: neo.fs.v2.accounting.BalanceResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader
8, // 6: neo.fs.v2.accounting.BalanceRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID
9, // 7: neo.fs.v2.accounting.BalanceResponse.Body.balance:type_name -> neo.fs.v2.accounting.Decimal
0, // 8: neo.fs.v2.accounting.AccountingService.Balance:input_type -> neo.fs.v2.accounting.BalanceRequest
1, // 9: neo.fs.v2.accounting.AccountingService.Balance:output_type -> neo.fs.v2.accounting.BalanceResponse
9, // [9:10] is the sub-list for method output_type
8, // [8:9] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_api_accounting_grpc_service_proto_init() }
func file_api_accounting_grpc_service_proto_init() {
if File_api_accounting_grpc_service_proto != nil {
return
}
file_api_accounting_grpc_types_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_accounting_grpc_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_api_accounting_grpc_service_proto_goTypes,
DependencyIndexes: file_api_accounting_grpc_service_proto_depIdxs,
MessageInfos: file_api_accounting_grpc_service_proto_msgTypes,
}.Build()
File_api_accounting_grpc_service_proto = out.File
file_api_accounting_grpc_service_proto_rawDesc = nil
file_api_accounting_grpc_service_proto_goTypes = nil
file_api_accounting_grpc_service_proto_depIdxs = nil
}

View file

@ -1,186 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/accounting/grpc/types.proto
//go:build !protoopaque
package accounting
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// Standard floating point data type can't be used in FrostFS due to inexactness
// of the result when doing lots of small number operations. To solve the lost
// precision issue, special `Decimal` format is used for monetary computations.
//
// Please see [The General Decimal Arithmetic
// Specification](http://speleotrove.com/decimal/) for detailed problem
// description.
type Decimal struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Number in the smallest Token fractions.
Value *int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
// Precision value indicating how many smallest fractions can be in one
// integer.
Precision *uint32 `protobuf:"varint,2,opt,name=precision" json:"precision,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Decimal) Reset() {
*x = Decimal{}
mi := &file_api_accounting_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Decimal) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Decimal) ProtoMessage() {}
func (x *Decimal) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_types_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Decimal) GetValue() int64 {
if x != nil && x.Value != nil {
return *x.Value
}
return 0
}
func (x *Decimal) GetPrecision() uint32 {
if x != nil && x.Precision != nil {
return *x.Precision
}
return 0
}
func (x *Decimal) SetValue(v int64) {
x.Value = &v
}
func (x *Decimal) SetPrecision(v uint32) {
x.Precision = &v
}
func (x *Decimal) HasValue() bool {
if x == nil {
return false
}
return x.Value != nil
}
func (x *Decimal) HasPrecision() bool {
if x == nil {
return false
}
return x.Precision != nil
}
func (x *Decimal) ClearValue() {
x.Value = nil
}
func (x *Decimal) ClearPrecision() {
x.Precision = nil
}
type Decimal_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Number in the smallest Token fractions.
Value *int64
// Precision value indicating how many smallest fractions can be in one
// integer.
Precision *uint32
}
func (b0 Decimal_builder) Build() *Decimal {
m0 := &Decimal{}
b, x := &b0, m0
_, _ = b, x
x.Value = b.Value
x.Precision = b.Precision
return m0
}
var File_api_accounting_grpc_types_proto protoreflect.FileDescriptor
var file_api_accounting_grpc_types_proto_rawDesc = []byte{
0x0a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x3d, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x69, 0x6d,
0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x63,
0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x70, 0x72, 0x65,
0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x6e, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72,
0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43,
0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d,
0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x69, 0x6e, 0x67, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65,
0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x70, 0xe8, 0x07,
}
var file_api_accounting_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_api_accounting_grpc_types_proto_goTypes = []any{
(*Decimal)(nil), // 0: neo.fs.v2.accounting.Decimal
}
var file_api_accounting_grpc_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_api_accounting_grpc_types_proto_init() }
func file_api_accounting_grpc_types_proto_init() {
if File_api_accounting_grpc_types_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_accounting_grpc_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_api_accounting_grpc_types_proto_goTypes,
DependencyIndexes: file_api_accounting_grpc_types_proto_depIdxs,
MessageInfos: file_api_accounting_grpc_types_proto_msgTypes,
}.Build()
File_api_accounting_grpc_types_proto = out.File
file_api_accounting_grpc_types_proto_rawDesc = nil
file_api_accounting_grpc_types_proto_goTypes = nil
file_api_accounting_grpc_types_proto_depIdxs = nil
}

204
api/accounting/grpc/types_frostfs.pb.go generated Normal file
View file

@ -0,0 +1,204 @@
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
import (
json "encoding/json"
fmt "fmt"
pool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool"
proto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto"
encoding "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding"
easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
strconv "strconv"
)
type Decimal struct {
Value int64 `json:"value"`
Precision uint32 `json:"precision"`
}
var (
_ encoding.ProtoMarshaler = (*Decimal)(nil)
_ encoding.ProtoUnmarshaler = (*Decimal)(nil)
_ json.Marshaler = (*Decimal)(nil)
_ json.Unmarshaler = (*Decimal)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *Decimal) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.Int64Size(1, x.Value)
size += proto.UInt32Size(2, x.Precision)
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *Decimal) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *Decimal) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if x.Value != 0 {
mm.AppendInt64(1, x.Value)
}
if x.Precision != 0 {
mm.AppendUint32(2, x.Precision)
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *Decimal) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "Decimal")
}
switch fc.FieldNum {
case 1: // Value
data, ok := fc.Int64()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Value")
}
x.Value = data
case 2: // Precision
data, ok := fc.Uint32()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Precision")
}
x.Precision = data
}
}
return nil
}
func (x *Decimal) GetValue() int64 {
if x != nil {
return x.Value
}
return 0
}
func (x *Decimal) SetValue(v int64) {
x.Value = v
}
func (x *Decimal) GetPrecision() uint32 {
if x != nil {
return x.Precision
}
return 0
}
func (x *Decimal) SetPrecision(v uint32) {
x.Precision = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *Decimal) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *Decimal) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendInt(out.Buffer.Buf, x.Value, 10)
out.RawByte('"')
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"precision\":"
out.RawString(prefix)
out.Uint32(x.Precision)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *Decimal) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *Decimal) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "value":
{
var f int64
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseInt(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := int64(v)
f = pv
x.Value = f
}
case "precision":
{
var f uint32
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.Precision = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}

View file

@ -0,0 +1,26 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
func DoFuzzProtoDecimal(data []byte) int {
msg := new(Decimal)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDecimal(data []byte) int {
msg := new(Decimal)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,21 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package accounting
import (
testing "testing"
)
func FuzzProtoDecimal(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDecimal(data)
})
}
func FuzzJSONDecimal(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDecimal(data)
})
}

View file

@ -1,195 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/accounting/grpc/types.proto
//go:build protoopaque
package accounting
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// Standard floating point data type can't be used in FrostFS due to inexactness
// of the result when doing lots of small number operations. To solve the lost
// precision issue, special `Decimal` format is used for monetary computations.
//
// Please see [The General Decimal Arithmetic
// Specification](http://speleotrove.com/decimal/) for detailed problem
// description.
type Decimal struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Value int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
xxx_hidden_Precision uint32 `protobuf:"varint,2,opt,name=precision" json:"precision,omitempty"`
XXX_raceDetectHookData protoimpl.RaceDetectHookData
XXX_presence [1]uint32
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Decimal) Reset() {
*x = Decimal{}
mi := &file_api_accounting_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Decimal) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Decimal) ProtoMessage() {}
func (x *Decimal) ProtoReflect() protoreflect.Message {
mi := &file_api_accounting_grpc_types_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Decimal) GetValue() int64 {
if x != nil {
return x.xxx_hidden_Value
}
return 0
}
func (x *Decimal) GetPrecision() uint32 {
if x != nil {
return x.xxx_hidden_Precision
}
return 0
}
func (x *Decimal) SetValue(v int64) {
x.xxx_hidden_Value = v
protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2)
}
func (x *Decimal) SetPrecision(v uint32) {
x.xxx_hidden_Precision = v
protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2)
}
func (x *Decimal) HasValue() bool {
if x == nil {
return false
}
return protoimpl.X.Present(&(x.XXX_presence[0]), 0)
}
func (x *Decimal) HasPrecision() bool {
if x == nil {
return false
}
return protoimpl.X.Present(&(x.XXX_presence[0]), 1)
}
func (x *Decimal) ClearValue() {
protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0)
x.xxx_hidden_Value = 0
}
func (x *Decimal) ClearPrecision() {
protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1)
x.xxx_hidden_Precision = 0
}
type Decimal_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Number in the smallest Token fractions.
Value *int64
// Precision value indicating how many smallest fractions can be in one
// integer.
Precision *uint32
}
func (b0 Decimal_builder) Build() *Decimal {
m0 := &Decimal{}
b, x := &b0, m0
_, _ = b, x
if b.Value != nil {
protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2)
x.xxx_hidden_Value = *b.Value
}
if b.Precision != nil {
protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2)
x.xxx_hidden_Precision = *b.Precision
}
return m0
}
var File_api_accounting_grpc_types_proto protoreflect.FileDescriptor
var file_api_accounting_grpc_types_proto_rawDesc = []byte{
0x0a, 0x1f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x3d, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x69, 0x6d,
0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x63,
0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x70, 0x72, 0x65,
0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x6e, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72,
0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43,
0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d,
0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x69, 0x6e, 0x67, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65,
0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x41, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x70, 0xe8, 0x07,
}
var file_api_accounting_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_api_accounting_grpc_types_proto_goTypes = []any{
(*Decimal)(nil), // 0: neo.fs.v2.accounting.Decimal
}
var file_api_accounting_grpc_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_api_accounting_grpc_types_proto_init() }
func file_api_accounting_grpc_types_proto_init() {
if File_api_accounting_grpc_types_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_accounting_grpc_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_api_accounting_grpc_types_proto_goTypes,
DependencyIndexes: file_api_accounting_grpc_types_proto_depIdxs,
MessageInfos: file_api_accounting_grpc_types_proto_msgTypes,
}.Build()
File_api_accounting_grpc_types_proto = out.File
file_api_accounting_grpc_types_proto_rawDesc = nil
file_api_accounting_grpc_types_proto_goTypes = nil
file_api_accounting_grpc_types_proto_depIdxs = nil
}

View file

@ -187,24 +187,24 @@ func (f *HeaderFilter) FromGRPCMessage(m grpc.Message) error {
return nil
}
func HeaderFiltersToGRPC(fs []HeaderFilter) (res []*acl.EACLRecord_Filter) {
func HeaderFiltersToGRPC(fs []HeaderFilter) (res []acl.EACLRecord_Filter) {
if fs != nil {
res = make([]*acl.EACLRecord_Filter, 0, len(fs))
res = make([]acl.EACLRecord_Filter, 0, len(fs))
for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter))
res = append(res, *fs[i].ToGRPCMessage().(*acl.EACLRecord_Filter))
}
}
return
}
func HeaderFiltersFromGRPC(fs []*acl.EACLRecord_Filter) (res []HeaderFilter, err error) {
func HeaderFiltersFromGRPC(fs []acl.EACLRecord_Filter) (res []HeaderFilter, err error) {
if fs != nil {
res = make([]HeaderFilter, len(fs))
for i := range fs {
err = res[i].FromGRPCMessage(fs[i])
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
@ -239,24 +239,24 @@ func (t *Target) FromGRPCMessage(m grpc.Message) error {
return nil
}
func TargetsToGRPC(ts []Target) (res []*acl.EACLRecord_Target) {
func TargetsToGRPC(ts []Target) (res []acl.EACLRecord_Target) {
if ts != nil {
res = make([]*acl.EACLRecord_Target, 0, len(ts))
res = make([]acl.EACLRecord_Target, 0, len(ts))
for i := range ts {
res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord_Target))
res = append(res, *ts[i].ToGRPCMessage().(*acl.EACLRecord_Target))
}
}
return
}
func TargetsFromGRPC(fs []*acl.EACLRecord_Target) (res []Target, err error) {
func TargetsFromGRPC(fs []acl.EACLRecord_Target) (res []Target, err error) {
if fs != nil {
res = make([]Target, len(fs))
for i := range fs {
err = res[i].FromGRPCMessage(fs[i])
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
@ -305,24 +305,24 @@ func (r *Record) FromGRPCMessage(m grpc.Message) error {
return nil
}
func RecordsToGRPC(ts []Record) (res []*acl.EACLRecord) {
func RecordsToGRPC(ts []Record) (res []acl.EACLRecord) {
if ts != nil {
res = make([]*acl.EACLRecord, 0, len(ts))
res = make([]acl.EACLRecord, 0, len(ts))
for i := range ts {
res = append(res, ts[i].ToGRPCMessage().(*acl.EACLRecord))
res = append(res, *ts[i].ToGRPCMessage().(*acl.EACLRecord))
}
}
return
}
func RecordsFromGRPC(fs []*acl.EACLRecord) (res []Record, err error) {
func RecordsFromGRPC(fs []acl.EACLRecord) (res []Record, err error) {
if fs != nil {
res = make([]Record, len(fs))
for i := range fs {
err = res[i].FromGRPCMessage(fs[i])
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
@ -423,9 +423,9 @@ func (c *APEOverride) ToGRPCMessage() grpc.Message {
m.SetTarget(c.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
if len(c.chains) > 0 {
apeChains := make([]*apeGRPC.Chain, len(c.chains))
apeChains := make([]apeGRPC.Chain, len(c.chains))
for i := range c.chains {
apeChains[i] = c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
apeChains[i] = *c.chains[i].ToGRPCMessage().(*apeGRPC.Chain)
}
m.SetChains(apeChains)
}
@ -453,7 +453,7 @@ func (c *APEOverride) FromGRPCMessage(m grpc.Message) error {
c.chains = make([]*ape.Chain, len(apeChains))
for i := range apeChains {
c.chains[i] = new(ape.Chain)
if err := c.chains[i].FromGRPCMessage(apeChains[i]); err != nil {
if err := c.chains[i].FromGRPCMessage(&apeChains[i]); err != nil {
return err
}
}

1534
api/acl/grpc/types.pb.go generated

File diff suppressed because it is too large Load diff

2184
api/acl/grpc/types_frostfs.pb.go generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,64 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package acl
func DoFuzzProtoEACLRecord(data []byte) int {
msg := new(EACLRecord)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONEACLRecord(data []byte) int {
msg := new(EACLRecord)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoEACLTable(data []byte) int {
msg := new(EACLTable)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONEACLTable(data []byte) int {
msg := new(EACLTable)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoBearerToken(data []byte) int {
msg := new(BearerToken)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONBearerToken(data []byte) int {
msg := new(BearerToken)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,41 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package acl
import (
testing "testing"
)
func FuzzProtoEACLRecord(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoEACLRecord(data)
})
}
func FuzzJSONEACLRecord(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONEACLRecord(data)
})
}
func FuzzProtoEACLTable(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoEACLTable(data)
})
}
func FuzzJSONEACLTable(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONEACLTable(data)
})
}
func FuzzProtoBearerToken(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoBearerToken(data)
})
}
func FuzzJSONBearerToken(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONBearerToken(data)
})
}

File diff suppressed because it is too large Load diff

View file

@ -14,9 +14,12 @@ func (x Action) String() string {
//
// Returns true if s was parsed successfully.
func (x *Action) FromString(s string) bool {
g, ok := acl.Action_value[s]
var g acl.Action
ok := g.FromString(s)
if ok {
*x = ActionFromGRPCField(acl.Action(g))
*x = ActionFromGRPCField(g)
}
return ok
@ -32,10 +35,12 @@ func (x Role) String() string {
//
// Returns true if s was parsed successfully.
func (x *Role) FromString(s string) bool {
g, ok := acl.Role_value[s]
var g acl.Role
ok := g.FromString(s)
if ok {
*x = RoleFromGRPCField(acl.Role(g))
*x = RoleFromGRPCField(g)
}
return ok
@ -51,9 +56,12 @@ func (x Operation) String() string {
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
g, ok := acl.Operation_value[s]
var g acl.Operation
ok := g.FromString(s)
if ok {
*x = OperationFromGRPCField(acl.Operation(g))
*x = OperationFromGRPCField(g)
}
return ok
@ -69,10 +77,12 @@ func (x MatchType) String() string {
//
// Returns true if s was parsed successfully.
func (x *MatchType) FromString(s string) bool {
g, ok := acl.MatchType_value[s]
var g acl.MatchType
ok := g.FromString(s)
if ok {
*x = MatchTypeFromGRPCField(acl.MatchType(g))
*x = MatchTypeFromGRPCField(g)
}
return ok
@ -88,10 +98,12 @@ func (x HeaderType) String() string {
//
// Returns true if s was parsed successfully.
func (x *HeaderType) FromString(s string) bool {
g, ok := acl.HeaderType_value[s]
var g acl.HeaderType
ok := g.FromString(s)
if ok {
*x = HeaderTypeFromGRPCField(acl.HeaderType(g))
*x = HeaderTypeFromGRPCField(g)
}
return ok

View file

@ -76,7 +76,8 @@ func (v2 *ChainRaw) ToGRPCMessage() grpc.Message {
if v2 != nil {
mgrpc = new(ape.Chain_Raw)
mgrpc.Raw = v2.GetRaw()
mgrpc.SetRaw(v2.GetRaw())
}
return mgrpc
@ -88,7 +89,7 @@ func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error {
return message.NewUnexpectedMessageType(m, mgrpc)
}
v2.SetRaw(mgrpc.Raw)
v2.SetRaw(mgrpc.GetRaw())
return nil
}
@ -103,7 +104,7 @@ func (v2 *Chain) ToGRPCMessage() grpc.Message {
default:
panic(fmt.Sprintf("unsupported chain kind: %T", chainKind))
case *ChainRaw:
mgrpc.SetRaw(chainKind.GetRaw())
mgrpc.SetKind(chainKind.ToGRPCMessage().(*ape.Chain_Raw))
}
}

376
api/ape/grpc/types.pb.go generated
View file

@ -1,376 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/ape/grpc/types.proto
//go:build !protoopaque
package ape
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// TargetType is a type target to which a rule chain is defined.
type TargetType int32
const (
TargetType_UNDEFINED TargetType = 0
TargetType_NAMESPACE TargetType = 1
TargetType_CONTAINER TargetType = 2
TargetType_USER TargetType = 3
TargetType_GROUP TargetType = 4
)
// Enum value maps for TargetType.
var (
TargetType_name = map[int32]string{
0: "UNDEFINED",
1: "NAMESPACE",
2: "CONTAINER",
3: "USER",
4: "GROUP",
}
TargetType_value = map[string]int32{
"UNDEFINED": 0,
"NAMESPACE": 1,
"CONTAINER": 2,
"USER": 3,
"GROUP": 4,
}
)
func (x TargetType) Enum() *TargetType {
p := new(TargetType)
*p = x
return p
}
func (x TargetType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TargetType) Descriptor() protoreflect.EnumDescriptor {
return file_api_ape_grpc_types_proto_enumTypes[0].Descriptor()
}
func (TargetType) Type() protoreflect.EnumType {
return &file_api_ape_grpc_types_proto_enumTypes[0]
}
func (x TargetType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// ChainTarget is an object to which a rule chain is defined.
type ChainTarget struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
Type *TargetType `protobuf:"varint,1,opt,name=type,enum=frostfs.v2.ape.TargetType" json:"type,omitempty"`
Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ChainTarget) Reset() {
*x = ChainTarget{}
mi := &file_api_ape_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ChainTarget) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ChainTarget) ProtoMessage() {}
func (x *ChainTarget) ProtoReflect() protoreflect.Message {
mi := &file_api_ape_grpc_types_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *ChainTarget) GetType() TargetType {
if x != nil && x.Type != nil {
return *x.Type
}
return TargetType_UNDEFINED
}
func (x *ChainTarget) GetName() string {
if x != nil && x.Name != nil {
return *x.Name
}
return ""
}
func (x *ChainTarget) SetType(v TargetType) {
x.Type = &v
}
func (x *ChainTarget) SetName(v string) {
x.Name = &v
}
func (x *ChainTarget) HasType() bool {
if x == nil {
return false
}
return x.Type != nil
}
func (x *ChainTarget) HasName() bool {
if x == nil {
return false
}
return x.Name != nil
}
func (x *ChainTarget) ClearType() {
x.Type = nil
}
func (x *ChainTarget) ClearName() {
x.Name = nil
}
type ChainTarget_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Type *TargetType
Name *string
}
func (b0 ChainTarget_builder) Build() *ChainTarget {
m0 := &ChainTarget{}
b, x := &b0, m0
_, _ = b, x
x.Type = b.Type
x.Name = b.Name
return m0
}
// Chain is a chain of rules defined for a specific target.
type Chain struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Types that are valid to be assigned to Kind:
//
// *Chain_Raw
Kind isChain_Kind `protobuf_oneof:"kind"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Chain) Reset() {
*x = Chain{}
mi := &file_api_ape_grpc_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Chain) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Chain) ProtoMessage() {}
func (x *Chain) ProtoReflect() protoreflect.Message {
mi := &file_api_ape_grpc_types_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Chain) GetKind() isChain_Kind {
if x != nil {
return x.Kind
}
return nil
}
func (x *Chain) GetRaw() []byte {
if x != nil {
if x, ok := x.Kind.(*Chain_Raw); ok {
return x.Raw
}
}
return nil
}
func (x *Chain) SetRaw(v []byte) {
if v == nil {
v = []byte{}
}
x.Kind = &Chain_Raw{v}
}
func (x *Chain) HasKind() bool {
if x == nil {
return false
}
return x.Kind != nil
}
func (x *Chain) HasRaw() bool {
if x == nil {
return false
}
_, ok := x.Kind.(*Chain_Raw)
return ok
}
func (x *Chain) ClearKind() {
x.Kind = nil
}
func (x *Chain) ClearRaw() {
if _, ok := x.Kind.(*Chain_Raw); ok {
x.Kind = nil
}
}
const Chain_Kind_not_set_case case_Chain_Kind = 0
const Chain_Raw_case case_Chain_Kind = 1
func (x *Chain) WhichKind() case_Chain_Kind {
if x == nil {
return Chain_Kind_not_set_case
}
switch x.Kind.(type) {
case *Chain_Raw:
return Chain_Raw_case
default:
return Chain_Kind_not_set_case
}
}
type Chain_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Fields of oneof Kind:
// Raw representation of a serizalized rule chain.
Raw []byte
// -- end of Kind
}
func (b0 Chain_builder) Build() *Chain {
m0 := &Chain{}
b, x := &b0, m0
_, _ = b, x
if b.Raw != nil {
x.Kind = &Chain_Raw{b.Raw}
}
return m0
}
type case_Chain_Kind protoreflect.FieldNumber
func (x case_Chain_Kind) String() string {
md := file_api_ape_grpc_types_proto_msgTypes[1].Descriptor()
if x == 0 {
return "not set"
}
return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x))
}
type isChain_Kind interface {
isChain_Kind()
}
type Chain_Raw struct {
// Raw representation of a serizalized rule chain.
Raw []byte `protobuf:"bytes,1,opt,name=raw,oneof"`
}
func (*Chain_Raw) isChain_Kind() {}
var File_api_ape_grpc_types_proto protoreflect.FileDescriptor
var file_api_ape_grpc_types_proto_rawDesc = []byte{
0x0a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74,
0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x66, 0x72, 0x6f, 0x73,
0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x22, 0x51, 0x0a, 0x0b, 0x43, 0x68,
0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54,
0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x23, 0x0a,
0x05, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x03, 0x72, 0x61, 0x77, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69,
0x6e, 0x64, 0x2a, 0x4e, 0x0a, 0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65,
0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12,
0x0d, 0x0a, 0x09, 0x4e, 0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12, 0x0d,
0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x02, 0x12, 0x08, 0x0a,
0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x4f, 0x55, 0x50,
0x10, 0x04, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64,
0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d,
0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b,
0x61, 0x70, 0x65, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var file_api_ape_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_api_ape_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_api_ape_grpc_types_proto_goTypes = []any{
(TargetType)(0), // 0: frostfs.v2.ape.TargetType
(*ChainTarget)(nil), // 1: frostfs.v2.ape.ChainTarget
(*Chain)(nil), // 2: frostfs.v2.ape.Chain
}
var file_api_ape_grpc_types_proto_depIdxs = []int32{
0, // 0: frostfs.v2.ape.ChainTarget.type:type_name -> frostfs.v2.ape.TargetType
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_api_ape_grpc_types_proto_init() }
func file_api_ape_grpc_types_proto_init() {
if File_api_ape_grpc_types_proto != nil {
return
}
file_api_ape_grpc_types_proto_msgTypes[1].OneofWrappers = []any{
(*Chain_Raw)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_ape_grpc_types_proto_rawDesc,
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_api_ape_grpc_types_proto_goTypes,
DependencyIndexes: file_api_ape_grpc_types_proto_depIdxs,
EnumInfos: file_api_ape_grpc_types_proto_enumTypes,
MessageInfos: file_api_ape_grpc_types_proto_msgTypes,
}.Build()
File_api_ape_grpc_types_proto = out.File
file_api_ape_grpc_types_proto_rawDesc = nil
file_api_ape_grpc_types_proto_goTypes = nil
file_api_ape_grpc_types_proto_depIdxs = nil
}

430
api/ape/grpc/types_frostfs.pb.go generated Normal file
View file

@ -0,0 +1,430 @@
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package ape
import (
json "encoding/json"
fmt "fmt"
pool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool"
proto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto"
encoding "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding"
easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
strconv "strconv"
)
type TargetType int32
const (
TargetType_UNDEFINED TargetType = 0
TargetType_NAMESPACE TargetType = 1
TargetType_CONTAINER TargetType = 2
TargetType_USER TargetType = 3
TargetType_GROUP TargetType = 4
)
var (
TargetType_name = map[int32]string{
0: "UNDEFINED",
1: "NAMESPACE",
2: "CONTAINER",
3: "USER",
4: "GROUP",
}
TargetType_value = map[string]int32{
"UNDEFINED": 0,
"NAMESPACE": 1,
"CONTAINER": 2,
"USER": 3,
"GROUP": 4,
}
)
func (x TargetType) String() string {
if v, ok := TargetType_name[int32(x)]; ok {
return v
}
return strconv.FormatInt(int64(x), 10)
}
func (x *TargetType) FromString(s string) bool {
if v, ok := TargetType_value[s]; ok {
*x = TargetType(v)
return true
}
return false
}
type ChainTarget struct {
Type TargetType `json:"type"`
Name string `json:"name"`
}
var (
_ encoding.ProtoMarshaler = (*ChainTarget)(nil)
_ encoding.ProtoUnmarshaler = (*ChainTarget)(nil)
_ json.Marshaler = (*ChainTarget)(nil)
_ json.Unmarshaler = (*ChainTarget)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *ChainTarget) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.EnumSize(1, int32(x.Type))
size += proto.StringSize(2, x.Name)
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *ChainTarget) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *ChainTarget) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if int32(x.Type) != 0 {
mm.AppendInt32(1, int32(x.Type))
}
if len(x.Name) != 0 {
mm.AppendString(2, x.Name)
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *ChainTarget) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "ChainTarget")
}
switch fc.FieldNum {
case 1: // Type
data, ok := fc.Int32()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Type")
}
x.Type = TargetType(data)
case 2: // Name
data, ok := fc.String()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Name")
}
x.Name = data
}
}
return nil
}
func (x *ChainTarget) GetType() TargetType {
if x != nil {
return x.Type
}
return 0
}
func (x *ChainTarget) SetType(v TargetType) {
x.Type = v
}
func (x *ChainTarget) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *ChainTarget) SetName(v string) {
x.Name = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *ChainTarget) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *ChainTarget) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"type\":"
out.RawString(prefix)
v := int32(x.Type)
if vv, ok := TargetType_name[v]; ok {
out.String(vv)
} else {
out.Int32(v)
}
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"name\":"
out.RawString(prefix)
out.String(x.Name)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *ChainTarget) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *ChainTarget) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "type":
{
var f TargetType
var parsedValue TargetType
switch v := in.Interface().(type) {
case string:
if vv, ok := TargetType_value[v]; ok {
parsedValue = TargetType(vv)
break
}
vv, err := strconv.ParseInt(v, 10, 32)
if err != nil {
in.AddError(err)
return
}
parsedValue = TargetType(vv)
case float64:
parsedValue = TargetType(v)
}
f = parsedValue
x.Type = f
}
case "name":
{
var f string
f = in.String()
x.Name = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
type Chain struct {
Kind isChain_Kind
}
var (
_ encoding.ProtoMarshaler = (*Chain)(nil)
_ encoding.ProtoUnmarshaler = (*Chain)(nil)
_ json.Marshaler = (*Chain)(nil)
_ json.Unmarshaler = (*Chain)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *Chain) StableSize() (size int) {
if x == nil {
return 0
}
if inner, ok := x.Kind.(*Chain_Raw); ok {
size += proto.BytesSize(1, inner.Raw)
}
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *Chain) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *Chain) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if inner, ok := x.Kind.(*Chain_Raw); ok {
if len(inner.Raw) != 0 {
mm.AppendBytes(1, inner.Raw)
}
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *Chain) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "Chain")
}
switch fc.FieldNum {
case 1: // Raw
data, ok := fc.Bytes()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Raw")
}
x.Kind = &Chain_Raw{Raw: data}
}
}
return nil
}
func (x *Chain) GetKind() isChain_Kind {
if x != nil {
return x.Kind
}
return nil
}
func (x *Chain) SetKind(v isChain_Kind) {
x.Kind = v
}
func (x *Chain) GetRaw() []byte {
if xx, ok := x.GetKind().(*Chain_Raw); ok {
return xx.Raw
}
return nil
}
func (x *Chain) SetRaw(v *Chain_Raw) {
x.Kind = v
}
func (x *Chain_Raw) GetRaw() []byte {
if x != nil {
return x.Raw
}
return nil
}
func (x *Chain_Raw) SetRaw(v []byte) {
x.Raw = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *Chain) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *Chain) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
switch xx := x.Kind.(type) {
case *Chain_Raw:
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"raw\":"
out.RawString(prefix)
if xx.Raw != nil {
out.Base64Bytes(xx.Raw)
} else {
out.String("")
}
}
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *Chain) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *Chain) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "raw":
xx := new(Chain_Raw)
x.Kind = xx
{
var f []byte
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
xx.Raw = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
type isChain_Kind interface {
isChain_Kind()
}
type Chain_Raw struct {
Raw []byte
}
func (*Chain_Raw) isChain_Kind() {}

View file

@ -0,0 +1,45 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package ape
func DoFuzzProtoChainTarget(data []byte) int {
msg := new(ChainTarget)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONChainTarget(data []byte) int {
msg := new(ChainTarget)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoChain(data []byte) int {
msg := new(Chain)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONChain(data []byte) int {
msg := new(Chain)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,31 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package ape
import (
testing "testing"
)
func FuzzProtoChainTarget(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoChainTarget(data)
})
}
func FuzzJSONChainTarget(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONChainTarget(data)
})
}
func FuzzProtoChain(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoChain(data)
})
}
func FuzzJSONChain(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONChain(data)
})
}

View file

@ -1,383 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/ape/grpc/types.proto
//go:build protoopaque
package ape
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// TargetType is a type target to which a rule chain is defined.
type TargetType int32
const (
TargetType_UNDEFINED TargetType = 0
TargetType_NAMESPACE TargetType = 1
TargetType_CONTAINER TargetType = 2
TargetType_USER TargetType = 3
TargetType_GROUP TargetType = 4
)
// Enum value maps for TargetType.
var (
TargetType_name = map[int32]string{
0: "UNDEFINED",
1: "NAMESPACE",
2: "CONTAINER",
3: "USER",
4: "GROUP",
}
TargetType_value = map[string]int32{
"UNDEFINED": 0,
"NAMESPACE": 1,
"CONTAINER": 2,
"USER": 3,
"GROUP": 4,
}
)
func (x TargetType) Enum() *TargetType {
p := new(TargetType)
*p = x
return p
}
func (x TargetType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TargetType) Descriptor() protoreflect.EnumDescriptor {
return file_api_ape_grpc_types_proto_enumTypes[0].Descriptor()
}
func (TargetType) Type() protoreflect.EnumType {
return &file_api_ape_grpc_types_proto_enumTypes[0]
}
func (x TargetType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// ChainTarget is an object to which a rule chain is defined.
type ChainTarget struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Type TargetType `protobuf:"varint,1,opt,name=type,enum=frostfs.v2.ape.TargetType" json:"type,omitempty"`
xxx_hidden_Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
XXX_raceDetectHookData protoimpl.RaceDetectHookData
XXX_presence [1]uint32
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ChainTarget) Reset() {
*x = ChainTarget{}
mi := &file_api_ape_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ChainTarget) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ChainTarget) ProtoMessage() {}
func (x *ChainTarget) ProtoReflect() protoreflect.Message {
mi := &file_api_ape_grpc_types_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *ChainTarget) GetType() TargetType {
if x != nil {
if protoimpl.X.Present(&(x.XXX_presence[0]), 0) {
return x.xxx_hidden_Type
}
}
return TargetType_UNDEFINED
}
func (x *ChainTarget) GetName() string {
if x != nil {
if x.xxx_hidden_Name != nil {
return *x.xxx_hidden_Name
}
return ""
}
return ""
}
func (x *ChainTarget) SetType(v TargetType) {
x.xxx_hidden_Type = v
protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2)
}
func (x *ChainTarget) SetName(v string) {
x.xxx_hidden_Name = &v
protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2)
}
func (x *ChainTarget) HasType() bool {
if x == nil {
return false
}
return protoimpl.X.Present(&(x.XXX_presence[0]), 0)
}
func (x *ChainTarget) HasName() bool {
if x == nil {
return false
}
return protoimpl.X.Present(&(x.XXX_presence[0]), 1)
}
func (x *ChainTarget) ClearType() {
protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0)
x.xxx_hidden_Type = TargetType_UNDEFINED
}
func (x *ChainTarget) ClearName() {
protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1)
x.xxx_hidden_Name = nil
}
type ChainTarget_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
Type *TargetType
Name *string
}
func (b0 ChainTarget_builder) Build() *ChainTarget {
m0 := &ChainTarget{}
b, x := &b0, m0
_, _ = b, x
if b.Type != nil {
protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2)
x.xxx_hidden_Type = *b.Type
}
if b.Name != nil {
protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2)
x.xxx_hidden_Name = b.Name
}
return m0
}
// Chain is a chain of rules defined for a specific target.
type Chain struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Kind isChain_Kind `protobuf_oneof:"kind"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Chain) Reset() {
*x = Chain{}
mi := &file_api_ape_grpc_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Chain) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Chain) ProtoMessage() {}
func (x *Chain) ProtoReflect() protoreflect.Message {
mi := &file_api_ape_grpc_types_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Chain) GetRaw() []byte {
if x != nil {
if x, ok := x.xxx_hidden_Kind.(*chain_Raw); ok {
return x.Raw
}
}
return nil
}
func (x *Chain) SetRaw(v []byte) {
if v == nil {
v = []byte{}
}
x.xxx_hidden_Kind = &chain_Raw{v}
}
func (x *Chain) HasKind() bool {
if x == nil {
return false
}
return x.xxx_hidden_Kind != nil
}
func (x *Chain) HasRaw() bool {
if x == nil {
return false
}
_, ok := x.xxx_hidden_Kind.(*chain_Raw)
return ok
}
func (x *Chain) ClearKind() {
x.xxx_hidden_Kind = nil
}
func (x *Chain) ClearRaw() {
if _, ok := x.xxx_hidden_Kind.(*chain_Raw); ok {
x.xxx_hidden_Kind = nil
}
}
const Chain_Kind_not_set_case case_Chain_Kind = 0
const Chain_Raw_case case_Chain_Kind = 1
func (x *Chain) WhichKind() case_Chain_Kind {
if x == nil {
return Chain_Kind_not_set_case
}
switch x.xxx_hidden_Kind.(type) {
case *chain_Raw:
return Chain_Raw_case
default:
return Chain_Kind_not_set_case
}
}
type Chain_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Fields of oneof xxx_hidden_Kind:
// Raw representation of a serizalized rule chain.
Raw []byte
// -- end of xxx_hidden_Kind
}
func (b0 Chain_builder) Build() *Chain {
m0 := &Chain{}
b, x := &b0, m0
_, _ = b, x
if b.Raw != nil {
x.xxx_hidden_Kind = &chain_Raw{b.Raw}
}
return m0
}
type case_Chain_Kind protoreflect.FieldNumber
func (x case_Chain_Kind) String() string {
md := file_api_ape_grpc_types_proto_msgTypes[1].Descriptor()
if x == 0 {
return "not set"
}
return protoimpl.X.MessageFieldStringOf(md, protoreflect.FieldNumber(x))
}
type isChain_Kind interface {
isChain_Kind()
}
type chain_Raw struct {
// Raw representation of a serizalized rule chain.
Raw []byte `protobuf:"bytes,1,opt,name=raw,oneof"`
}
func (*chain_Raw) isChain_Kind() {}
var File_api_ape_grpc_types_proto protoreflect.FileDescriptor
var file_api_ape_grpc_types_proto_rawDesc = []byte{
0x0a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74,
0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x66, 0x72, 0x6f, 0x73,
0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x22, 0x51, 0x0a, 0x0b, 0x43, 0x68,
0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54,
0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x23, 0x0a,
0x05, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x03, 0x72, 0x61, 0x77, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69,
0x6e, 0x64, 0x2a, 0x4e, 0x0a, 0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65,
0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12,
0x0d, 0x0a, 0x09, 0x4e, 0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12, 0x0d,
0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x02, 0x12, 0x08, 0x0a,
0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x4f, 0x55, 0x50,
0x10, 0x04, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64,
0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d,
0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b,
0x61, 0x70, 0x65, 0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var file_api_ape_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_api_ape_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_api_ape_grpc_types_proto_goTypes = []any{
(TargetType)(0), // 0: frostfs.v2.ape.TargetType
(*ChainTarget)(nil), // 1: frostfs.v2.ape.ChainTarget
(*Chain)(nil), // 2: frostfs.v2.ape.Chain
}
var file_api_ape_grpc_types_proto_depIdxs = []int32{
0, // 0: frostfs.v2.ape.ChainTarget.type:type_name -> frostfs.v2.ape.TargetType
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_api_ape_grpc_types_proto_init() }
func file_api_ape_grpc_types_proto_init() {
if File_api_ape_grpc_types_proto != nil {
return
}
file_api_ape_grpc_types_proto_msgTypes[1].OneofWrappers = []any{
(*chain_Raw)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_ape_grpc_types_proto_rawDesc,
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_api_ape_grpc_types_proto_goTypes,
DependencyIndexes: file_api_ape_grpc_types_proto_depIdxs,
EnumInfos: file_api_ape_grpc_types_proto_enumTypes,
MessageInfos: file_api_ape_grpc_types_proto_msgTypes,
}.Build()
File_api_ape_grpc_types_proto = out.File
file_api_ape_grpc_types_proto_rawDesc = nil
file_api_ape_grpc_types_proto_goTypes = nil
file_api_ape_grpc_types_proto_depIdxs = nil
}

View file

@ -296,9 +296,9 @@ func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message {
if respBody != nil {
respBodygrpc = new(apemanager.ListChainsResponse_Body)
chainsgrpc := make([]*apeGRPC.Chain, 0, len(respBody.GetChains()))
chainsgrpc := make([]apeGRPC.Chain, 0, len(respBody.GetChains()))
for _, chain := range respBody.GetChains() {
chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apeGRPC.Chain))
chainsgrpc = append(chainsgrpc, *chain.ToGRPCMessage().(*apeGRPC.Chain))
}
respBodygrpc.SetChains(chainsgrpc)
@ -317,7 +317,7 @@ func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error {
for _, chaingrpc := range respBodygrpc.GetChains() {
chain := new(ape.Chain)
if err := chain.FromGRPCMessage(chaingrpc); err != nil {
if err := chain.FromGRPCMessage(&chaingrpc); err != nil {
return err
}
chains = append(chains, chain)

File diff suppressed because it is too large Load diff

2337
api/apemanager/grpc/service_frostfs.pb.go generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,121 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package apemanager
func DoFuzzProtoAddChainRequest(data []byte) int {
msg := new(AddChainRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONAddChainRequest(data []byte) int {
msg := new(AddChainRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoAddChainResponse(data []byte) int {
msg := new(AddChainResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONAddChainResponse(data []byte) int {
msg := new(AddChainResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoRemoveChainRequest(data []byte) int {
msg := new(RemoveChainRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONRemoveChainRequest(data []byte) int {
msg := new(RemoveChainRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoRemoveChainResponse(data []byte) int {
msg := new(RemoveChainResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONRemoveChainResponse(data []byte) int {
msg := new(RemoveChainResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListChainsRequest(data []byte) int {
msg := new(ListChainsRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListChainsRequest(data []byte) int {
msg := new(ListChainsRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListChainsResponse(data []byte) int {
msg := new(ListChainsResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListChainsResponse(data []byte) int {
msg := new(ListChainsResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,71 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package apemanager
import (
testing "testing"
)
func FuzzProtoAddChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoAddChainRequest(data)
})
}
func FuzzJSONAddChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONAddChainRequest(data)
})
}
func FuzzProtoAddChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoAddChainResponse(data)
})
}
func FuzzJSONAddChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONAddChainResponse(data)
})
}
func FuzzProtoRemoveChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoRemoveChainRequest(data)
})
}
func FuzzJSONRemoveChainRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONRemoveChainRequest(data)
})
}
func FuzzProtoRemoveChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoRemoveChainResponse(data)
})
}
func FuzzJSONRemoveChainResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONRemoveChainResponse(data)
})
}
func FuzzProtoListChainsRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListChainsRequest(data)
})
}
func FuzzJSONListChainsRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListChainsRequest(data)
})
}
func FuzzProtoListChainsResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListChainsResponse(data)
})
}
func FuzzJSONListChainsResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListChainsResponse(data)
})
}

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.29.2
// - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.2
// source: api/apemanager/grpc/service.proto
package apemanager
@ -15,8 +15,8 @@ import (
// 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
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
APEManagerService_AddChain_FullMethodName = "/frostfs.v2.apemanager.APEManagerService/AddChain"
@ -27,44 +27,41 @@ const (
// APEManagerServiceClient is the client API for APEManagerService 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.
//
// `APEManagerService` provides API to manage rule chains within sidechain's
// `Policy` smart contract.
type APEManagerServiceClient interface {
// Add a rule chain for a specific target to `Policy` smart contract.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// the chain has been successfully added;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
// - **OK** (0, SECTION_SUCCESS): \
// the chain has been successfully added;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
AddChain(ctx context.Context, in *AddChainRequest, opts ...grpc.CallOption) (*AddChainResponse, error)
// Remove a rule chain for a specific target from `Policy` smart contract.
// RemoveChain is an idempotent operation: removal of non-existing rule chain
// also means success.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// the chain has been successfully removed;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
// - **OK** (0, SECTION_SUCCESS): \
// the chain has been successfully removed;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
RemoveChain(ctx context.Context, in *RemoveChainRequest, opts ...grpc.CallOption) (*RemoveChainResponse, error)
// List chains defined for a specific target from `Policy` smart contract.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// chains have been successfully listed;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
// - **OK** (0, SECTION_SUCCESS): \
// chains have been successfully listed;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
ListChains(ctx context.Context, in *ListChainsRequest, opts ...grpc.CallOption) (*ListChainsResponse, error)
}
@ -77,9 +74,8 @@ func NewAPEManagerServiceClient(cc grpc.ClientConnInterface) APEManagerServiceCl
}
func (c *aPEManagerServiceClient) AddChain(ctx context.Context, in *AddChainRequest, opts ...grpc.CallOption) (*AddChainResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddChainResponse)
err := c.cc.Invoke(ctx, APEManagerService_AddChain_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, APEManagerService_AddChain_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -87,9 +83,8 @@ func (c *aPEManagerServiceClient) AddChain(ctx context.Context, in *AddChainRequ
}
func (c *aPEManagerServiceClient) RemoveChain(ctx context.Context, in *RemoveChainRequest, opts ...grpc.CallOption) (*RemoveChainResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RemoveChainResponse)
err := c.cc.Invoke(ctx, APEManagerService_RemoveChain_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, APEManagerService_RemoveChain_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -97,9 +92,8 @@ func (c *aPEManagerServiceClient) RemoveChain(ctx context.Context, in *RemoveCha
}
func (c *aPEManagerServiceClient) ListChains(ctx context.Context, in *ListChainsRequest, opts ...grpc.CallOption) (*ListChainsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListChainsResponse)
err := c.cc.Invoke(ctx, APEManagerService_ListChains_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, APEManagerService_ListChains_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -108,54 +102,48 @@ func (c *aPEManagerServiceClient) ListChains(ctx context.Context, in *ListChains
// APEManagerServiceServer is the server API for APEManagerService service.
// All implementations should embed UnimplementedAPEManagerServiceServer
// for forward compatibility.
//
// `APEManagerService` provides API to manage rule chains within sidechain's
// `Policy` smart contract.
// for forward compatibility
type APEManagerServiceServer interface {
// Add a rule chain for a specific target to `Policy` smart contract.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// the chain has been successfully added;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
// - **OK** (0, SECTION_SUCCESS): \
// the chain has been successfully added;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
AddChain(context.Context, *AddChainRequest) (*AddChainResponse, error)
// Remove a rule chain for a specific target from `Policy` smart contract.
// RemoveChain is an idempotent operation: removal of non-existing rule chain
// also means success.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// the chain has been successfully removed;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
// - **OK** (0, SECTION_SUCCESS): \
// the chain has been successfully removed;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
RemoveChain(context.Context, *RemoveChainRequest) (*RemoveChainResponse, error)
// List chains defined for a specific target from `Policy` smart contract.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// chains have been successfully listed;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
// - **OK** (0, SECTION_SUCCESS): \
// chains have been successfully listed;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// container (as target) not found;
// - **APE_MANAGER_ACCESS_DENIED** (5120, SECTION_APE_MANAGER): \
// the operation is denied by the service.
ListChains(context.Context, *ListChainsRequest) (*ListChainsResponse, error)
}
// UnimplementedAPEManagerServiceServer should 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 UnimplementedAPEManagerServiceServer struct{}
// UnimplementedAPEManagerServiceServer should be embedded to have forward compatible implementations.
type UnimplementedAPEManagerServiceServer struct {
}
func (UnimplementedAPEManagerServiceServer) AddChain(context.Context, *AddChainRequest) (*AddChainResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddChain not implemented")
@ -166,7 +154,6 @@ func (UnimplementedAPEManagerServiceServer) RemoveChain(context.Context, *Remove
func (UnimplementedAPEManagerServiceServer) ListChains(context.Context, *ListChainsRequest) (*ListChainsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListChains not implemented")
}
func (UnimplementedAPEManagerServiceServer) testEmbeddedByValue() {}
// UnsafeAPEManagerServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to APEManagerServiceServer will
@ -176,13 +163,6 @@ type UnsafeAPEManagerServiceServer interface {
}
func RegisterAPEManagerServiceServer(s grpc.ServiceRegistrar, srv APEManagerServiceServer) {
// If the following call pancis, it indicates UnimplementedAPEManagerServiceServer 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(&APEManagerService_ServiceDesc, srv)
}

File diff suppressed because it is too large Load diff

View file

@ -37,24 +37,24 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil
}
func AttributesToGRPC(xs []Attribute) (res []*container.Container_Attribute) {
func AttributesToGRPC(xs []Attribute) (res []container.Container_Attribute) {
if xs != nil {
res = make([]*container.Container_Attribute, 0, len(xs))
res = make([]container.Container_Attribute, 0, len(xs))
for i := range xs {
res = append(res, xs[i].ToGRPCMessage().(*container.Container_Attribute))
res = append(res, *xs[i].ToGRPCMessage().(*container.Container_Attribute))
}
}
return
}
func AttributesFromGRPC(xs []*container.Container_Attribute) (res []Attribute, err error) {
func AttributesFromGRPC(xs []container.Container_Attribute) (res []Attribute, err error) {
if xs != nil {
res = make([]Attribute, len(xs))
for i := range xs {
err = res[i].FromGRPCMessage(xs[i])
err = res[i].FromGRPCMessage(&xs[i])
if err != nil {
return
}
@ -762,138 +762,3 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error {
return r.ResponseHeaders.FromMessage(v)
}
func (r *ListStreamRequestBody) ToGRPCMessage() grpc.Message {
var m *container.ListStreamRequest_Body
if r != nil {
m = new(container.ListStreamRequest_Body)
m.SetOwnerId(r.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID))
}
return m
}
func (r *ListStreamRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.ListStreamRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
ownerID := v.GetOwnerId()
if ownerID == nil {
r.ownerID = nil
} else {
if r.ownerID == nil {
r.ownerID = new(refs.OwnerID)
}
err = r.ownerID.FromGRPCMessage(ownerID)
}
return err
}
func (r *ListStreamRequest) ToGRPCMessage() grpc.Message {
var m *container.ListStreamRequest
if r != nil {
m = new(container.ListStreamRequest)
m.SetBody(r.body.ToGRPCMessage().(*container.ListStreamRequest_Body))
r.RequestHeaders.ToMessage(m)
}
return m
}
func (r *ListStreamRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.ListStreamRequest)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(ListStreamRequestBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.RequestHeaders.FromMessage(v)
}
func (r *ListStreamResponseBody) ToGRPCMessage() grpc.Message {
var m *container.ListStreamResponse_Body
if r != nil {
m = new(container.ListStreamResponse_Body)
m.SetContainerIds(refs.ContainerIDsToGRPCMessage(r.cidList))
}
return m
}
func (r *ListStreamResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.ListStreamResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
r.cidList, err = refs.ContainerIDsFromGRPCMessage(v.GetContainerIds())
return err
}
func (r *ListStreamResponse) ToGRPCMessage() grpc.Message {
var m *container.ListStreamResponse
if r != nil {
m = new(container.ListStreamResponse)
m.SetBody(r.body.ToGRPCMessage().(*container.ListStreamResponse_Body))
r.ResponseHeaders.ToMessage(m)
}
return m
}
func (r *ListStreamResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.ListStreamResponse)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(ListStreamResponseBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.ResponseHeaders.FromMessage(v)
}

File diff suppressed because it is too large Load diff

3157
api/container/grpc/service_frostfs.pb.go generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,159 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
func DoFuzzProtoPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListRequest(data []byte) int {
msg := new(ListRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListRequest(data []byte) int {
msg := new(ListRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoListResponse(data []byte) int {
msg := new(ListResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONListResponse(data []byte) int {
msg := new(ListResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,91 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
import (
testing "testing"
)
func FuzzProtoPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutRequest(data)
})
}
func FuzzJSONPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutRequest(data)
})
}
func FuzzProtoPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutResponse(data)
})
}
func FuzzJSONPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutResponse(data)
})
}
func FuzzProtoDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteRequest(data)
})
}
func FuzzJSONDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteRequest(data)
})
}
func FuzzProtoDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteResponse(data)
})
}
func FuzzJSONDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteResponse(data)
})
}
func FuzzProtoGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRequest(data)
})
}
func FuzzJSONGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRequest(data)
})
}
func FuzzProtoGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetResponse(data)
})
}
func FuzzJSONGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetResponse(data)
})
}
func FuzzProtoListRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListRequest(data)
})
}
func FuzzJSONListRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListRequest(data)
})
}
func FuzzProtoListResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoListResponse(data)
})
}
func FuzzJSONListResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONListResponse(data)
})
}

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.29.2
// - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.2
// source: api/container/grpc/service.proto
package container
@ -15,25 +15,19 @@ import (
// 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
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
ContainerService_Put_FullMethodName = "/neo.fs.v2.container.ContainerService/Put"
ContainerService_Delete_FullMethodName = "/neo.fs.v2.container.ContainerService/Delete"
ContainerService_Get_FullMethodName = "/neo.fs.v2.container.ContainerService/Get"
ContainerService_List_FullMethodName = "/neo.fs.v2.container.ContainerService/List"
ContainerService_ListStream_FullMethodName = "/neo.fs.v2.container.ContainerService/ListStream"
ContainerService_Put_FullMethodName = "/neo.fs.v2.container.ContainerService/Put"
ContainerService_Delete_FullMethodName = "/neo.fs.v2.container.ContainerService/Delete"
ContainerService_Get_FullMethodName = "/neo.fs.v2.container.ContainerService/Get"
ContainerService_List_FullMethodName = "/neo.fs.v2.container.ContainerService/List"
)
// ContainerServiceClient is the client API for ContainerService 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.
//
// `ContainerService` provides API to interact with `Container` smart contract
// in FrostFS sidechain via other FrostFS nodes. All of those actions can be
// done equivalently by directly issuing transactions and RPC calls to sidechain
// nodes.
type ContainerServiceClient interface {
// `Put` invokes `Container` smart contract's `Put` method and returns
// response immediately. After a new block is issued in sidechain, request is
@ -41,11 +35,11 @@ type ContainerServiceClient interface {
// container is added into smart contract storage.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// request to save the container has been sent to the sidechain;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container create access denied.
// - **OK** (0, SECTION_SUCCESS): \
// request to save the container has been sent to the sidechain;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container create access denied.
Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error)
// `Delete` invokes `Container` smart contract's `Delete` method and returns
// response immediately. After a new block is issued in sidechain, request is
@ -53,42 +47,32 @@ type ContainerServiceClient interface {
// container is added into smart contract storage.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// request to remove the container has been sent to the sidechain;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container delete access denied.
// - **OK** (0, SECTION_SUCCESS): \
// request to remove the container has been sent to the sidechain;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container delete access denied.
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
// Returns container structure from `Container` smart contract storage.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// container has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// requested container not found;
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// access to container is denied.
// - **OK** (0, SECTION_SUCCESS): \
// container has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// requested container not found;
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// access to container is denied.
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
// Returns all owner's containers from `Container` smart contract storage.
// Returns all owner's containers from 'Container` smart contract' storage.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// container list has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container list access denied.
// - **OK** (0, SECTION_SUCCESS): \
// container list has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container list access denied.
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
// Returns all owner's containers from `Container` smart contract storage
// via stream.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// container list has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container list access denied.
ListStream(ctx context.Context, in *ListStreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListStreamResponse], error)
}
type containerServiceClient struct {
@ -100,9 +84,8 @@ func NewContainerServiceClient(cc grpc.ClientConnInterface) ContainerServiceClie
}
func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PutResponse)
err := c.cc.Invoke(ctx, ContainerService_Put_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, ContainerService_Put_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -110,9 +93,8 @@ func (c *containerServiceClient) Put(ctx context.Context, in *PutRequest, opts .
}
func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteResponse)
err := c.cc.Invoke(ctx, ContainerService_Delete_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, ContainerService_Delete_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -120,9 +102,8 @@ func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest,
}
func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetResponse)
err := c.cc.Invoke(ctx, ContainerService_Get_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, ContainerService_Get_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -130,42 +111,17 @@ func (c *containerServiceClient) Get(ctx context.Context, in *GetRequest, opts .
}
func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListResponse)
err := c.cc.Invoke(ctx, ContainerService_List_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, ContainerService_List_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *containerServiceClient) ListStream(ctx context.Context, in *ListStreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListStreamResponse], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &ContainerService_ServiceDesc.Streams[0], ContainerService_ListStream_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[ListStreamRequest, ListStreamResponse]{ClientStream: stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ContainerService_ListStreamClient = grpc.ServerStreamingClient[ListStreamResponse]
// ContainerServiceServer is the server API for ContainerService service.
// All implementations should embed UnimplementedContainerServiceServer
// for forward compatibility.
//
// `ContainerService` provides API to interact with `Container` smart contract
// in FrostFS sidechain via other FrostFS nodes. All of those actions can be
// done equivalently by directly issuing transactions and RPC calls to sidechain
// nodes.
// for forward compatibility
type ContainerServiceServer interface {
// `Put` invokes `Container` smart contract's `Put` method and returns
// response immediately. After a new block is issued in sidechain, request is
@ -173,11 +129,11 @@ type ContainerServiceServer interface {
// container is added into smart contract storage.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// request to save the container has been sent to the sidechain;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container create access denied.
// - **OK** (0, SECTION_SUCCESS): \
// request to save the container has been sent to the sidechain;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container create access denied.
Put(context.Context, *PutRequest) (*PutResponse, error)
// `Delete` invokes `Container` smart contract's `Delete` method and returns
// response immediately. After a new block is issued in sidechain, request is
@ -185,50 +141,37 @@ type ContainerServiceServer interface {
// container is added into smart contract storage.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// request to remove the container has been sent to the sidechain;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container delete access denied.
// - **OK** (0, SECTION_SUCCESS): \
// request to remove the container has been sent to the sidechain;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container delete access denied.
Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
// Returns container structure from `Container` smart contract storage.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// container has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// requested container not found;
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// access to container is denied.
// - **OK** (0, SECTION_SUCCESS): \
// container has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// requested container not found;
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// access to container is denied.
Get(context.Context, *GetRequest) (*GetResponse, error)
// Returns all owner's containers from `Container` smart contract storage.
// Returns all owner's containers from 'Container` smart contract' storage.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// container list has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container list access denied.
// - **OK** (0, SECTION_SUCCESS): \
// container list has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container list access denied.
List(context.Context, *ListRequest) (*ListResponse, error)
// Returns all owner's containers from `Container` smart contract storage
// via stream.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// container list has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON);
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
// container list access denied.
ListStream(*ListStreamRequest, grpc.ServerStreamingServer[ListStreamResponse]) error
}
// UnimplementedContainerServiceServer should 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 UnimplementedContainerServiceServer struct{}
// UnimplementedContainerServiceServer should be embedded to have forward compatible implementations.
type UnimplementedContainerServiceServer struct {
}
func (UnimplementedContainerServiceServer) Put(context.Context, *PutRequest) (*PutResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Put not implemented")
@ -242,10 +185,6 @@ func (UnimplementedContainerServiceServer) Get(context.Context, *GetRequest) (*G
func (UnimplementedContainerServiceServer) List(context.Context, *ListRequest) (*ListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedContainerServiceServer) ListStream(*ListStreamRequest, grpc.ServerStreamingServer[ListStreamResponse]) error {
return status.Errorf(codes.Unimplemented, "method ListStream not implemented")
}
func (UnimplementedContainerServiceServer) testEmbeddedByValue() {}
// UnsafeContainerServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ContainerServiceServer will
@ -255,13 +194,6 @@ type UnsafeContainerServiceServer interface {
}
func RegisterContainerServiceServer(s grpc.ServiceRegistrar, srv ContainerServiceServer) {
// If the following call pancis, it indicates UnimplementedContainerServiceServer 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(&ContainerService_ServiceDesc, srv)
}
@ -337,17 +269,6 @@ func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
func _ContainerService_ListStream_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(ListStreamRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(ContainerServiceServer).ListStream(m, &grpc.GenericServerStream[ListStreamRequest, ListStreamResponse]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ContainerService_ListStreamServer = grpc.ServerStreamingServer[ListStreamResponse]
// ContainerService_ServiceDesc is the grpc.ServiceDesc for ContainerService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -372,12 +293,6 @@ var ContainerService_ServiceDesc = grpc.ServiceDesc{
Handler: _ContainerService_List_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "ListStream",
Handler: _ContainerService_ListStream_Handler,
ServerStreams: true,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "api/container/grpc/service.proto",
}

File diff suppressed because it is too large Load diff

View file

@ -1,447 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/container/grpc/types.proto
//go:build !protoopaque
package container
import (
grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc"
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// Container is a structure that defines object placement behaviour. Objects can
// be stored only within containers. They define placement rule, attributes and
// access control information. An ID of a container is a 32 byte long SHA256
// hash of stable-marshalled container message.
type Container struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Container format version. Effectively, the version of API library used to
// create the container.
Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"`
// Identifier of the container owner
OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"`
// Nonce is a 16 byte UUIDv4, used to avoid collisions of `ContainerID`s
Nonce []byte `protobuf:"bytes,3,opt,name=nonce" json:"nonce,omitempty"`
// `BasicACL` contains access control rules for the owner, system and others
// groups, as well as permission bits for `BearerToken` and `Extended ACL`
BasicAcl *uint32 `protobuf:"varint,4,opt,name=basic_acl,json=basicACL" json:"basic_acl,omitempty"`
// Attributes represent immutable container's meta data
Attributes []*Container_Attribute `protobuf:"bytes,5,rep,name=attributes" json:"attributes,omitempty"`
// Placement policy for the object inside the container
PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy" json:"placement_policy,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Container) Reset() {
*x = Container{}
mi := &file_api_container_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Container) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Container) ProtoMessage() {}
func (x *Container) ProtoReflect() protoreflect.Message {
mi := &file_api_container_grpc_types_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Container) GetVersion() *grpc.Version {
if x != nil {
return x.Version
}
return nil
}
func (x *Container) GetOwnerId() *grpc.OwnerID {
if x != nil {
return x.OwnerId
}
return nil
}
func (x *Container) GetNonce() []byte {
if x != nil {
return x.Nonce
}
return nil
}
func (x *Container) GetBasicAcl() uint32 {
if x != nil && x.BasicAcl != nil {
return *x.BasicAcl
}
return 0
}
func (x *Container) GetAttributes() []*Container_Attribute {
if x != nil {
return x.Attributes
}
return nil
}
func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy {
if x != nil {
return x.PlacementPolicy
}
return nil
}
func (x *Container) SetVersion(v *grpc.Version) {
x.Version = v
}
func (x *Container) SetOwnerId(v *grpc.OwnerID) {
x.OwnerId = v
}
func (x *Container) SetNonce(v []byte) {
if v == nil {
v = []byte{}
}
x.Nonce = v
}
func (x *Container) SetBasicAcl(v uint32) {
x.BasicAcl = &v
}
func (x *Container) SetAttributes(v []*Container_Attribute) {
x.Attributes = v
}
func (x *Container) SetPlacementPolicy(v *grpc1.PlacementPolicy) {
x.PlacementPolicy = v
}
func (x *Container) HasVersion() bool {
if x == nil {
return false
}
return x.Version != nil
}
func (x *Container) HasOwnerId() bool {
if x == nil {
return false
}
return x.OwnerId != nil
}
func (x *Container) HasNonce() bool {
if x == nil {
return false
}
return x.Nonce != nil
}
func (x *Container) HasBasicAcl() bool {
if x == nil {
return false
}
return x.BasicAcl != nil
}
func (x *Container) HasPlacementPolicy() bool {
if x == nil {
return false
}
return x.PlacementPolicy != nil
}
func (x *Container) ClearVersion() {
x.Version = nil
}
func (x *Container) ClearOwnerId() {
x.OwnerId = nil
}
func (x *Container) ClearNonce() {
x.Nonce = nil
}
func (x *Container) ClearBasicAcl() {
x.BasicAcl = nil
}
func (x *Container) ClearPlacementPolicy() {
x.PlacementPolicy = nil
}
type Container_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Container format version. Effectively, the version of API library used to
// create the container.
Version *grpc.Version
// Identifier of the container owner
OwnerId *grpc.OwnerID
// Nonce is a 16 byte UUIDv4, used to avoid collisions of `ContainerID`s
Nonce []byte
// `BasicACL` contains access control rules for the owner, system and others
// groups, as well as permission bits for `BearerToken` and `Extended ACL`
BasicAcl *uint32
// Attributes represent immutable container's meta data
Attributes []*Container_Attribute
// Placement policy for the object inside the container
PlacementPolicy *grpc1.PlacementPolicy
}
func (b0 Container_builder) Build() *Container {
m0 := &Container{}
b, x := &b0, m0
_, _ = b, x
x.Version = b.Version
x.OwnerId = b.OwnerId
x.Nonce = b.Nonce
x.BasicAcl = b.BasicAcl
x.Attributes = b.Attributes
x.PlacementPolicy = b.PlacementPolicy
return m0
}
// `Attribute` is a user-defined Key-Value metadata pair attached to the
// container. Container attributes are immutable. They are set at the moment
// of container creation and can never be added or updated.
//
// Key name must be a container-unique valid UTF-8 string. Value can't be
// empty. Containers with duplicated attribute names or attributes with empty
// values will be considered invalid.
//
// There are some "well-known" attributes affecting system behaviour:
//
// - [ __SYSTEM__NAME ] \
// (`__NEOFS__NAME` is deprecated) \
// String of a human-friendly container name registered as a domain in
// NNS contract.
// - [ __SYSTEM__ZONE ] \
// (`__NEOFS__ZONE` is deprecated) \
// String of a zone for `__SYSTEM__NAME` (`__NEOFS__NAME` is deprecated).
// Used as a TLD of a domain name in NNS contract. If no zone is specified,
// use default zone: `container`.
// - [ __SYSTEM__DISABLE_HOMOMORPHIC_HASHING ] \
// (`__NEOFS__DISABLE_HOMOMORPHIC_HASHING` is deprecated) \
// Disables homomorphic hashing for the container if the value equals "true"
// string. Any other values are interpreted as missing attribute. Container
// could be accepted in a FrostFS network only if the global network hashing
// configuration value corresponds with that attribute's value. After
// container inclusion, network setting is ignored.
//
// And some well-known attributes used by applications only:
//
// - Name \
// Human-friendly name
// - Timestamp \
// User-defined local time of container creation in Unix Timestamp format
type Container_Attribute struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Attribute name key
Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
// Attribute value
Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Container_Attribute) Reset() {
*x = Container_Attribute{}
mi := &file_api_container_grpc_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Container_Attribute) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Container_Attribute) ProtoMessage() {}
func (x *Container_Attribute) ProtoReflect() protoreflect.Message {
mi := &file_api_container_grpc_types_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Container_Attribute) GetKey() string {
if x != nil && x.Key != nil {
return *x.Key
}
return ""
}
func (x *Container_Attribute) GetValue() string {
if x != nil && x.Value != nil {
return *x.Value
}
return ""
}
func (x *Container_Attribute) SetKey(v string) {
x.Key = &v
}
func (x *Container_Attribute) SetValue(v string) {
x.Value = &v
}
func (x *Container_Attribute) HasKey() bool {
if x == nil {
return false
}
return x.Key != nil
}
func (x *Container_Attribute) HasValue() bool {
if x == nil {
return false
}
return x.Value != nil
}
func (x *Container_Attribute) ClearKey() {
x.Key = nil
}
func (x *Container_Attribute) ClearValue() {
x.Value = nil
}
type Container_Attribute_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Attribute name key
Key *string
// Attribute value
Value *string
}
func (b0 Container_Attribute_builder) Build() *Container_Attribute {
m0 := &Container_Attribute{}
b, x := &b0, m0
_, _ = b, x
x.Key = b.Key
x.Value = b.Value
return m0
}
var File_api_container_grpc_types_proto protoreflect.FileDescriptor
var file_api_container_grpc_types_proto_rawDesc = []byte{
0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f,
0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x13, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74,
0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61,
0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70,
0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf2, 0x02,
0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e,
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x32,
0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66,
0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72,
0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69,
0x63, 0x5f, 0x61, 0x63, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x62, 0x61, 0x73,
0x69, 0x63, 0x41, 0x43, 0x4c, 0x12, 0x48, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e,
0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12,
0x4c, 0x0a, 0x10, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x6c,
0x69, 0x63, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x50, 0x6c, 0x61,
0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0f, 0x70, 0x6c,
0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x1a, 0x33, 0x0a,
0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x42, 0x6b, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64,
0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d,
0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0xaa,
0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67,
0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62,
0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var file_api_container_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_api_container_grpc_types_proto_goTypes = []any{
(*Container)(nil), // 0: neo.fs.v2.container.Container
(*Container_Attribute)(nil), // 1: neo.fs.v2.container.Container.Attribute
(*grpc.Version)(nil), // 2: neo.fs.v2.refs.Version
(*grpc.OwnerID)(nil), // 3: neo.fs.v2.refs.OwnerID
(*grpc1.PlacementPolicy)(nil), // 4: neo.fs.v2.netmap.PlacementPolicy
}
var file_api_container_grpc_types_proto_depIdxs = []int32{
2, // 0: neo.fs.v2.container.Container.version:type_name -> neo.fs.v2.refs.Version
3, // 1: neo.fs.v2.container.Container.owner_id:type_name -> neo.fs.v2.refs.OwnerID
1, // 2: neo.fs.v2.container.Container.attributes:type_name -> neo.fs.v2.container.Container.Attribute
4, // 3: neo.fs.v2.container.Container.placement_policy:type_name -> neo.fs.v2.netmap.PlacementPolicy
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_api_container_grpc_types_proto_init() }
func file_api_container_grpc_types_proto_init() {
if File_api_container_grpc_types_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_container_grpc_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_api_container_grpc_types_proto_goTypes,
DependencyIndexes: file_api_container_grpc_types_proto_depIdxs,
MessageInfos: file_api_container_grpc_types_proto_msgTypes,
}.Build()
File_api_container_grpc_types_proto = out.File
file_api_container_grpc_types_proto_rawDesc = nil
file_api_container_grpc_types_proto_goTypes = nil
file_api_container_grpc_types_proto_depIdxs = nil
}

554
api/container/grpc/types_frostfs.pb.go generated Normal file
View file

@ -0,0 +1,554 @@
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
import (
json "encoding/json"
fmt "fmt"
grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc"
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
pool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool"
proto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto"
encoding "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding"
easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
strconv "strconv"
)
type Container_Attribute struct {
Key string `json:"key"`
Value string `json:"value"`
}
var (
_ encoding.ProtoMarshaler = (*Container_Attribute)(nil)
_ encoding.ProtoUnmarshaler = (*Container_Attribute)(nil)
_ json.Marshaler = (*Container_Attribute)(nil)
_ json.Unmarshaler = (*Container_Attribute)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *Container_Attribute) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.StringSize(1, x.Key)
size += proto.StringSize(2, x.Value)
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *Container_Attribute) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *Container_Attribute) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if len(x.Key) != 0 {
mm.AppendString(1, x.Key)
}
if len(x.Value) != 0 {
mm.AppendString(2, x.Value)
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *Container_Attribute) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "Container_Attribute")
}
switch fc.FieldNum {
case 1: // Key
data, ok := fc.String()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Key")
}
x.Key = data
case 2: // Value
data, ok := fc.String()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Value")
}
x.Value = data
}
}
return nil
}
func (x *Container_Attribute) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *Container_Attribute) SetKey(v string) {
x.Key = v
}
func (x *Container_Attribute) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
func (x *Container_Attribute) SetValue(v string) {
x.Value = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *Container_Attribute) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *Container_Attribute) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"key\":"
out.RawString(prefix)
out.String(x.Key)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"value\":"
out.RawString(prefix)
out.String(x.Value)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *Container_Attribute) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *Container_Attribute) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "key":
{
var f string
f = in.String()
x.Key = f
}
case "value":
{
var f string
f = in.String()
x.Value = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
type Container struct {
Version *grpc.Version `json:"version"`
OwnerId *grpc.OwnerID `json:"ownerID"`
Nonce []byte `json:"nonce"`
BasicAcl uint32 `json:"basicACL"`
Attributes []Container_Attribute `json:"attributes"`
PlacementPolicy *grpc1.PlacementPolicy `json:"placementPolicy"`
}
var (
_ encoding.ProtoMarshaler = (*Container)(nil)
_ encoding.ProtoUnmarshaler = (*Container)(nil)
_ json.Marshaler = (*Container)(nil)
_ json.Unmarshaler = (*Container)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *Container) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.NestedStructureSize(1, x.Version)
size += proto.NestedStructureSize(2, x.OwnerId)
size += proto.BytesSize(3, x.Nonce)
size += proto.UInt32Size(4, x.BasicAcl)
for i := range x.Attributes {
size += proto.NestedStructureSizeUnchecked(5, &x.Attributes[i])
}
size += proto.NestedStructureSize(6, x.PlacementPolicy)
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *Container) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *Container) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if x.Version != nil {
x.Version.EmitProtobuf(mm.AppendMessage(1))
}
if x.OwnerId != nil {
x.OwnerId.EmitProtobuf(mm.AppendMessage(2))
}
if len(x.Nonce) != 0 {
mm.AppendBytes(3, x.Nonce)
}
if x.BasicAcl != 0 {
mm.AppendUint32(4, x.BasicAcl)
}
for i := range x.Attributes {
x.Attributes[i].EmitProtobuf(mm.AppendMessage(5))
}
if x.PlacementPolicy != nil {
x.PlacementPolicy.EmitProtobuf(mm.AppendMessage(6))
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *Container) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "Container")
}
switch fc.FieldNum {
case 1: // Version
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Version")
}
x.Version = new(grpc.Version)
if err := x.Version.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 2: // OwnerId
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "OwnerId")
}
x.OwnerId = new(grpc.OwnerID)
if err := x.OwnerId.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 3: // Nonce
data, ok := fc.Bytes()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Nonce")
}
x.Nonce = data
case 4: // BasicAcl
data, ok := fc.Uint32()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "BasicAcl")
}
x.BasicAcl = data
case 5: // Attributes
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Attributes")
}
x.Attributes = append(x.Attributes, Container_Attribute{})
ff := &x.Attributes[len(x.Attributes)-1]
if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 6: // PlacementPolicy
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "PlacementPolicy")
}
x.PlacementPolicy = new(grpc1.PlacementPolicy)
if err := x.PlacementPolicy.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
}
}
return nil
}
func (x *Container) GetVersion() *grpc.Version {
if x != nil {
return x.Version
}
return nil
}
func (x *Container) SetVersion(v *grpc.Version) {
x.Version = v
}
func (x *Container) GetOwnerId() *grpc.OwnerID {
if x != nil {
return x.OwnerId
}
return nil
}
func (x *Container) SetOwnerId(v *grpc.OwnerID) {
x.OwnerId = v
}
func (x *Container) GetNonce() []byte {
if x != nil {
return x.Nonce
}
return nil
}
func (x *Container) SetNonce(v []byte) {
x.Nonce = v
}
func (x *Container) GetBasicAcl() uint32 {
if x != nil {
return x.BasicAcl
}
return 0
}
func (x *Container) SetBasicAcl(v uint32) {
x.BasicAcl = v
}
func (x *Container) GetAttributes() []Container_Attribute {
if x != nil {
return x.Attributes
}
return nil
}
func (x *Container) SetAttributes(v []Container_Attribute) {
x.Attributes = v
}
func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy {
if x != nil {
return x.PlacementPolicy
}
return nil
}
func (x *Container) SetPlacementPolicy(v *grpc1.PlacementPolicy) {
x.PlacementPolicy = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *Container) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *Container) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"version\":"
out.RawString(prefix)
x.Version.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerID\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"nonce\":"
out.RawString(prefix)
if x.Nonce != nil {
out.Base64Bytes(x.Nonce)
} else {
out.String("")
}
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"basicACL\":"
out.RawString(prefix)
out.Uint32(x.BasicAcl)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"attributes\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Attributes {
if i != 0 {
out.RawByte(',')
}
x.Attributes[i].MarshalEasyJSON(out)
}
out.RawByte(']')
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"placementPolicy\":"
out.RawString(prefix)
x.PlacementPolicy.MarshalEasyJSON(out)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *Container) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *Container) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "version":
{
var f *grpc.Version
f = new(grpc.Version)
f.UnmarshalEasyJSON(in)
x.Version = f
}
case "ownerID":
{
var f *grpc.OwnerID
f = new(grpc.OwnerID)
f.UnmarshalEasyJSON(in)
x.OwnerId = f
}
case "nonce":
{
var f []byte
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Nonce = f
}
case "basicACL":
{
var f uint32
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 32)
if err != nil {
in.AddError(err)
return
}
pv := uint32(v)
f = pv
x.BasicAcl = f
}
case "attributes":
{
var f Container_Attribute
var list []Container_Attribute
in.Delim('[')
for !in.IsDelim(']') {
f = Container_Attribute{}
f.UnmarshalEasyJSON(in)
list = append(list, f)
in.WantComma()
}
x.Attributes = list
in.Delim(']')
}
case "placementPolicy":
{
var f *grpc1.PlacementPolicy
f = new(grpc1.PlacementPolicy)
f.UnmarshalEasyJSON(in)
x.PlacementPolicy = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}

View file

@ -0,0 +1,26 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
func DoFuzzProtoContainer(data []byte) int {
msg := new(Container)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONContainer(data []byte) int {
msg := new(Container)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,21 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package container
import (
testing "testing"
)
func FuzzProtoContainer(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoContainer(data)
})
}
func FuzzJSONContainer(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONContainer(data)
})
}

View file

@ -1,469 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/container/grpc/types.proto
//go:build protoopaque
package container
import (
grpc1 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc"
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// Container is a structure that defines object placement behaviour. Objects can
// be stored only within containers. They define placement rule, attributes and
// access control information. An ID of a container is a 32 byte long SHA256
// hash of stable-marshalled container message.
type Container struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Version *grpc.Version `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"`
xxx_hidden_OwnerId *grpc.OwnerID `protobuf:"bytes,2,opt,name=owner_id,json=ownerID" json:"owner_id,omitempty"`
xxx_hidden_Nonce []byte `protobuf:"bytes,3,opt,name=nonce" json:"nonce,omitempty"`
xxx_hidden_BasicAcl uint32 `protobuf:"varint,4,opt,name=basic_acl,json=basicACL" json:"basic_acl,omitempty"`
xxx_hidden_Attributes *[]*Container_Attribute `protobuf:"bytes,5,rep,name=attributes" json:"attributes,omitempty"`
xxx_hidden_PlacementPolicy *grpc1.PlacementPolicy `protobuf:"bytes,6,opt,name=placement_policy,json=placementPolicy" json:"placement_policy,omitempty"`
XXX_raceDetectHookData protoimpl.RaceDetectHookData
XXX_presence [1]uint32
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Container) Reset() {
*x = Container{}
mi := &file_api_container_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Container) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Container) ProtoMessage() {}
func (x *Container) ProtoReflect() protoreflect.Message {
mi := &file_api_container_grpc_types_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Container) GetVersion() *grpc.Version {
if x != nil {
return x.xxx_hidden_Version
}
return nil
}
func (x *Container) GetOwnerId() *grpc.OwnerID {
if x != nil {
return x.xxx_hidden_OwnerId
}
return nil
}
func (x *Container) GetNonce() []byte {
if x != nil {
return x.xxx_hidden_Nonce
}
return nil
}
func (x *Container) GetBasicAcl() uint32 {
if x != nil {
return x.xxx_hidden_BasicAcl
}
return 0
}
func (x *Container) GetAttributes() []*Container_Attribute {
if x != nil {
if x.xxx_hidden_Attributes != nil {
return *x.xxx_hidden_Attributes
}
}
return nil
}
func (x *Container) GetPlacementPolicy() *grpc1.PlacementPolicy {
if x != nil {
return x.xxx_hidden_PlacementPolicy
}
return nil
}
func (x *Container) SetVersion(v *grpc.Version) {
x.xxx_hidden_Version = v
}
func (x *Container) SetOwnerId(v *grpc.OwnerID) {
x.xxx_hidden_OwnerId = v
}
func (x *Container) SetNonce(v []byte) {
if v == nil {
v = []byte{}
}
x.xxx_hidden_Nonce = v
protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 6)
}
func (x *Container) SetBasicAcl(v uint32) {
x.xxx_hidden_BasicAcl = v
protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 6)
}
func (x *Container) SetAttributes(v []*Container_Attribute) {
x.xxx_hidden_Attributes = &v
}
func (x *Container) SetPlacementPolicy(v *grpc1.PlacementPolicy) {
x.xxx_hidden_PlacementPolicy = v
}
func (x *Container) HasVersion() bool {
if x == nil {
return false
}
return x.xxx_hidden_Version != nil
}
func (x *Container) HasOwnerId() bool {
if x == nil {
return false
}
return x.xxx_hidden_OwnerId != nil
}
func (x *Container) HasNonce() bool {
if x == nil {
return false
}
return protoimpl.X.Present(&(x.XXX_presence[0]), 2)
}
func (x *Container) HasBasicAcl() bool {
if x == nil {
return false
}
return protoimpl.X.Present(&(x.XXX_presence[0]), 3)
}
func (x *Container) HasPlacementPolicy() bool {
if x == nil {
return false
}
return x.xxx_hidden_PlacementPolicy != nil
}
func (x *Container) ClearVersion() {
x.xxx_hidden_Version = nil
}
func (x *Container) ClearOwnerId() {
x.xxx_hidden_OwnerId = nil
}
func (x *Container) ClearNonce() {
protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2)
x.xxx_hidden_Nonce = nil
}
func (x *Container) ClearBasicAcl() {
protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3)
x.xxx_hidden_BasicAcl = 0
}
func (x *Container) ClearPlacementPolicy() {
x.xxx_hidden_PlacementPolicy = nil
}
type Container_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Container format version. Effectively, the version of API library used to
// create the container.
Version *grpc.Version
// Identifier of the container owner
OwnerId *grpc.OwnerID
// Nonce is a 16 byte UUIDv4, used to avoid collisions of `ContainerID`s
Nonce []byte
// `BasicACL` contains access control rules for the owner, system and others
// groups, as well as permission bits for `BearerToken` and `Extended ACL`
BasicAcl *uint32
// Attributes represent immutable container's meta data
Attributes []*Container_Attribute
// Placement policy for the object inside the container
PlacementPolicy *grpc1.PlacementPolicy
}
func (b0 Container_builder) Build() *Container {
m0 := &Container{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Version = b.Version
x.xxx_hidden_OwnerId = b.OwnerId
if b.Nonce != nil {
protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 6)
x.xxx_hidden_Nonce = b.Nonce
}
if b.BasicAcl != nil {
protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 6)
x.xxx_hidden_BasicAcl = *b.BasicAcl
}
x.xxx_hidden_Attributes = &b.Attributes
x.xxx_hidden_PlacementPolicy = b.PlacementPolicy
return m0
}
// `Attribute` is a user-defined Key-Value metadata pair attached to the
// container. Container attributes are immutable. They are set at the moment
// of container creation and can never be added or updated.
//
// Key name must be a container-unique valid UTF-8 string. Value can't be
// empty. Containers with duplicated attribute names or attributes with empty
// values will be considered invalid.
//
// There are some "well-known" attributes affecting system behaviour:
//
// - [ __SYSTEM__NAME ] \
// (`__NEOFS__NAME` is deprecated) \
// String of a human-friendly container name registered as a domain in
// NNS contract.
// - [ __SYSTEM__ZONE ] \
// (`__NEOFS__ZONE` is deprecated) \
// String of a zone for `__SYSTEM__NAME` (`__NEOFS__NAME` is deprecated).
// Used as a TLD of a domain name in NNS contract. If no zone is specified,
// use default zone: `container`.
// - [ __SYSTEM__DISABLE_HOMOMORPHIC_HASHING ] \
// (`__NEOFS__DISABLE_HOMOMORPHIC_HASHING` is deprecated) \
// Disables homomorphic hashing for the container if the value equals "true"
// string. Any other values are interpreted as missing attribute. Container
// could be accepted in a FrostFS network only if the global network hashing
// configuration value corresponds with that attribute's value. After
// container inclusion, network setting is ignored.
//
// And some well-known attributes used by applications only:
//
// - Name \
// Human-friendly name
// - Timestamp \
// User-defined local time of container creation in Unix Timestamp format
type Container_Attribute struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
xxx_hidden_Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
XXX_raceDetectHookData protoimpl.RaceDetectHookData
XXX_presence [1]uint32
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Container_Attribute) Reset() {
*x = Container_Attribute{}
mi := &file_api_container_grpc_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Container_Attribute) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Container_Attribute) ProtoMessage() {}
func (x *Container_Attribute) ProtoReflect() protoreflect.Message {
mi := &file_api_container_grpc_types_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Container_Attribute) GetKey() string {
if x != nil {
if x.xxx_hidden_Key != nil {
return *x.xxx_hidden_Key
}
return ""
}
return ""
}
func (x *Container_Attribute) GetValue() string {
if x != nil {
if x.xxx_hidden_Value != nil {
return *x.xxx_hidden_Value
}
return ""
}
return ""
}
func (x *Container_Attribute) SetKey(v string) {
x.xxx_hidden_Key = &v
protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 2)
}
func (x *Container_Attribute) SetValue(v string) {
x.xxx_hidden_Value = &v
protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2)
}
func (x *Container_Attribute) HasKey() bool {
if x == nil {
return false
}
return protoimpl.X.Present(&(x.XXX_presence[0]), 0)
}
func (x *Container_Attribute) HasValue() bool {
if x == nil {
return false
}
return protoimpl.X.Present(&(x.XXX_presence[0]), 1)
}
func (x *Container_Attribute) ClearKey() {
protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0)
x.xxx_hidden_Key = nil
}
func (x *Container_Attribute) ClearValue() {
protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1)
x.xxx_hidden_Value = nil
}
type Container_Attribute_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Attribute name key
Key *string
// Attribute value
Value *string
}
func (b0 Container_Attribute_builder) Build() *Container_Attribute {
m0 := &Container_Attribute{}
b, x := &b0, m0
_, _ = b, x
if b.Key != nil {
protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 2)
x.xxx_hidden_Key = b.Key
}
if b.Value != nil {
protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2)
x.xxx_hidden_Value = b.Value
}
return m0
}
var File_api_container_grpc_types_proto protoreflect.FileDescriptor
var file_api_container_grpc_types_proto_rawDesc = []byte{
0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2f,
0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x13, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74,
0x61, 0x69, 0x6e, 0x65, 0x72, 0x1a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x65, 0x74, 0x6d, 0x61,
0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70,
0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf2, 0x02,
0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x07, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e,
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x32,
0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66,
0x73, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72,
0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69,
0x63, 0x5f, 0x61, 0x63, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x62, 0x61, 0x73,
0x69, 0x63, 0x41, 0x43, 0x4c, 0x12, 0x48, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e,
0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12,
0x4c, 0x0a, 0x10, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x6c,
0x69, 0x63, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x50, 0x6c, 0x61,
0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0f, 0x70, 0x6c,
0x61, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x1a, 0x33, 0x0a,
0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x42, 0x6b, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64,
0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d,
0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0xaa,
0x02, 0x1d, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67,
0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x62,
0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var file_api_container_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_api_container_grpc_types_proto_goTypes = []any{
(*Container)(nil), // 0: neo.fs.v2.container.Container
(*Container_Attribute)(nil), // 1: neo.fs.v2.container.Container.Attribute
(*grpc.Version)(nil), // 2: neo.fs.v2.refs.Version
(*grpc.OwnerID)(nil), // 3: neo.fs.v2.refs.OwnerID
(*grpc1.PlacementPolicy)(nil), // 4: neo.fs.v2.netmap.PlacementPolicy
}
var file_api_container_grpc_types_proto_depIdxs = []int32{
2, // 0: neo.fs.v2.container.Container.version:type_name -> neo.fs.v2.refs.Version
3, // 1: neo.fs.v2.container.Container.owner_id:type_name -> neo.fs.v2.refs.OwnerID
1, // 2: neo.fs.v2.container.Container.attributes:type_name -> neo.fs.v2.container.Container.Attribute
4, // 3: neo.fs.v2.container.Container.placement_policy:type_name -> neo.fs.v2.netmap.PlacementPolicy
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_api_container_grpc_types_proto_init() }
func file_api_container_grpc_types_proto_init() {
if File_api_container_grpc_types_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_container_grpc_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_api_container_grpc_types_proto_goTypes,
DependencyIndexes: file_api_container_grpc_types_proto_depIdxs,
MessageInfos: file_api_container_grpc_types_proto_msgTypes,
}.Build()
File_api_container_grpc_types_proto = out.File
file_api_container_grpc_types_proto_rawDesc = nil
file_api_container_grpc_types_proto_goTypes = nil
file_api_container_grpc_types_proto_depIdxs = nil
}

View file

@ -343,65 +343,3 @@ func (r *ListResponseBody) StableSize() (size int) {
func (r *ListResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.ListResponse_Body))
}
func (r *ListStreamRequestBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
protoutil.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID)
return buf
}
func (r *ListStreamRequestBody) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.NestedStructureSize(listReqBodyOwnerField, r.ownerID)
return size
}
func (r *ListStreamRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.ListStreamRequest_Body))
}
func (r *ListStreamResponseBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
var offset int
for i := range r.cidList {
offset += protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], &r.cidList[i])
}
return buf
}
func (r *ListStreamResponseBody) StableSize() (size int) {
if r == nil {
return 0
}
for i := range r.cidList {
size += protoutil.NestedStructureSize(listRespBodyIDsField, &r.cidList[i])
}
return size
}
func (r *ListStreamResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.ListStreamResponse_Body))
}

View file

@ -109,26 +109,6 @@ type ListResponse struct {
session.ResponseHeaders
}
type ListStreamRequestBody struct {
ownerID *refs.OwnerID
}
type ListStreamRequest struct {
body *ListStreamRequestBody
session.RequestHeaders
}
type ListStreamResponseBody struct {
cidList []refs.ContainerID
}
type ListStreamResponse struct {
body *ListStreamResponseBody
session.ResponseHeaders
}
func (a *Attribute) GetKey() string {
if a != nil {
return a.key
@ -464,51 +444,3 @@ func (r *ListResponse) GetBody() *ListResponseBody {
func (r *ListResponse) SetBody(v *ListResponseBody) {
r.body = v
}
func (r *ListStreamRequestBody) GetOwnerID() *refs.OwnerID {
if r != nil {
return r.ownerID
}
return nil
}
func (r *ListStreamRequestBody) SetOwnerID(v *refs.OwnerID) {
r.ownerID = v
}
func (r *ListStreamRequest) GetBody() *ListStreamRequestBody {
if r != nil {
return r.body
}
return nil
}
func (r *ListStreamRequest) SetBody(v *ListStreamRequestBody) {
r.body = v
}
func (r *ListStreamResponseBody) GetContainerIDs() []refs.ContainerID {
if r != nil {
return r.cidList
}
return nil
}
func (r *ListStreamResponseBody) SetContainerIDs(v []refs.ContainerID) {
r.cidList = v
}
func (r *ListStreamResponse) GetBody() *ListStreamResponseBody {
if r != nil {
return r.body
}
return nil
}
func (r *ListStreamResponse) SetBody(v *ListStreamResponseBody) {
r.body = v
}

View file

@ -1,148 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/lock/grpc/types.proto
//go:build !protoopaque
package lock
import (
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// Lock objects protects a list of objects from being deleted. The lifetime of a
// lock object is limited similar to regular objects in
// `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated)
// attribute. Lock object MUST have expiration epoch. It is impossible to delete
// a lock object via ObjectService.Delete RPC call.
type Lock struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// List of objects to lock. Must not be empty or carry empty IDs.
// All members must be of the `REGULAR` type.
Members []*grpc.ObjectID `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Lock) Reset() {
*x = Lock{}
mi := &file_api_lock_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Lock) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Lock) ProtoMessage() {}
func (x *Lock) ProtoReflect() protoreflect.Message {
mi := &file_api_lock_grpc_types_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Lock) GetMembers() []*grpc.ObjectID {
if x != nil {
return x.Members
}
return nil
}
func (x *Lock) SetMembers(v []*grpc.ObjectID) {
x.Members = v
}
type Lock_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// List of objects to lock. Must not be empty or carry empty IDs.
// All members must be of the `REGULAR` type.
Members []*grpc.ObjectID
}
func (b0 Lock_builder) Build() *Lock {
m0 := &Lock{}
b, x := &b0, m0
_, _ = b, x
x.Members = b.Members
return m0
}
var File_api_lock_grpc_types_proto protoreflect.FileDescriptor
var file_api_lock_grpc_types_proto_rawDesc = []byte{
0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f,
0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6c, 0x6f, 0x63, 0x6b, 0x1a, 0x19, 0x61, 0x70, 0x69,
0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3a, 0x0a, 0x04, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x32,
0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73,
0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65,
0x72, 0x73, 0x42, 0x5c, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64,
0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d,
0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x67, 0x72, 0x70, 0x63,
0x3b, 0x6c, 0x6f, 0x63, 0x6b, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65,
0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4c, 0x6f, 0x63, 0x6b,
0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var file_api_lock_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_api_lock_grpc_types_proto_goTypes = []any{
(*Lock)(nil), // 0: neo.fs.v2.lock.Lock
(*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID
}
var file_api_lock_grpc_types_proto_depIdxs = []int32{
1, // 0: neo.fs.v2.lock.Lock.members:type_name -> neo.fs.v2.refs.ObjectID
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_api_lock_grpc_types_proto_init() }
func file_api_lock_grpc_types_proto_init() {
if File_api_lock_grpc_types_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_lock_grpc_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_api_lock_grpc_types_proto_goTypes,
DependencyIndexes: file_api_lock_grpc_types_proto_depIdxs,
MessageInfos: file_api_lock_grpc_types_proto_msgTypes,
}.Build()
File_api_lock_grpc_types_proto = out.File
file_api_lock_grpc_types_proto_rawDesc = nil
file_api_lock_grpc_types_proto_goTypes = nil
file_api_lock_grpc_types_proto_depIdxs = nil
}

171
api/lock/grpc/types_frostfs.pb.go generated Normal file
View file

@ -0,0 +1,171 @@
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package lock
import (
json "encoding/json"
fmt "fmt"
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
pool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool"
proto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto"
encoding "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding"
easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
type Lock struct {
Members []grpc.ObjectID `json:"members"`
}
var (
_ encoding.ProtoMarshaler = (*Lock)(nil)
_ encoding.ProtoUnmarshaler = (*Lock)(nil)
_ json.Marshaler = (*Lock)(nil)
_ json.Unmarshaler = (*Lock)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *Lock) StableSize() (size int) {
if x == nil {
return 0
}
for i := range x.Members {
size += proto.NestedStructureSizeUnchecked(1, &x.Members[i])
}
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *Lock) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *Lock) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
for i := range x.Members {
x.Members[i].EmitProtobuf(mm.AppendMessage(1))
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *Lock) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "Lock")
}
switch fc.FieldNum {
case 1: // Members
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Members")
}
x.Members = append(x.Members, grpc.ObjectID{})
ff := &x.Members[len(x.Members)-1]
if err := ff.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
}
}
return nil
}
func (x *Lock) GetMembers() []grpc.ObjectID {
if x != nil {
return x.Members
}
return nil
}
func (x *Lock) SetMembers(v []grpc.ObjectID) {
x.Members = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *Lock) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *Lock) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"members\":"
out.RawString(prefix)
out.RawByte('[')
for i := range x.Members {
if i != 0 {
out.RawByte(',')
}
x.Members[i].MarshalEasyJSON(out)
}
out.RawByte(']')
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *Lock) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *Lock) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "members":
{
var f grpc.ObjectID
var list []grpc.ObjectID
in.Delim('[')
for !in.IsDelim(']') {
f = grpc.ObjectID{}
f.UnmarshalEasyJSON(in)
list = append(list, f)
in.WantComma()
}
x.Members = list
in.Delim(']')
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}

View file

@ -0,0 +1,26 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package lock
func DoFuzzProtoLock(data []byte) int {
msg := new(Lock)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONLock(data []byte) int {
msg := new(Lock)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,21 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package lock
import (
testing "testing"
)
func FuzzProtoLock(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoLock(data)
})
}
func FuzzJSONLock(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONLock(data)
})
}

View file

@ -1,148 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/lock/grpc/types.proto
//go:build protoopaque
package lock
import (
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// Lock objects protects a list of objects from being deleted. The lifetime of a
// lock object is limited similar to regular objects in
// `__SYSTEM__EXPIRATION_EPOCH` (`__NEOFS__EXPIRATION_EPOCH` is deprecated)
// attribute. Lock object MUST have expiration epoch. It is impossible to delete
// a lock object via ObjectService.Delete RPC call.
type Lock struct {
state protoimpl.MessageState `protogen:"opaque.v1"`
xxx_hidden_Members *[]*grpc.ObjectID `protobuf:"bytes,1,rep,name=members" json:"members,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Lock) Reset() {
*x = Lock{}
mi := &file_api_lock_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Lock) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Lock) ProtoMessage() {}
func (x *Lock) ProtoReflect() protoreflect.Message {
mi := &file_api_lock_grpc_types_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *Lock) GetMembers() []*grpc.ObjectID {
if x != nil {
if x.xxx_hidden_Members != nil {
return *x.xxx_hidden_Members
}
}
return nil
}
func (x *Lock) SetMembers(v []*grpc.ObjectID) {
x.xxx_hidden_Members = &v
}
type Lock_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// List of objects to lock. Must not be empty or carry empty IDs.
// All members must be of the `REGULAR` type.
Members []*grpc.ObjectID
}
func (b0 Lock_builder) Build() *Lock {
m0 := &Lock{}
b, x := &b0, m0
_, _ = b, x
x.xxx_hidden_Members = &b.Members
return m0
}
var File_api_lock_grpc_types_proto protoreflect.FileDescriptor
var file_api_lock_grpc_types_proto_rawDesc = []byte{
0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f,
0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x6c, 0x6f, 0x63, 0x6b, 0x1a, 0x19, 0x61, 0x70, 0x69,
0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3a, 0x0a, 0x04, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x32,
0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73,
0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65,
0x72, 0x73, 0x42, 0x5c, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64,
0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2d,
0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x67, 0x72, 0x70, 0x63,
0x3b, 0x6c, 0x6f, 0x63, 0x6b, 0xaa, 0x02, 0x18, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65,
0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x4c, 0x6f, 0x63, 0x6b,
0x62, 0x08, 0x65, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var file_api_lock_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_api_lock_grpc_types_proto_goTypes = []any{
(*Lock)(nil), // 0: neo.fs.v2.lock.Lock
(*grpc.ObjectID)(nil), // 1: neo.fs.v2.refs.ObjectID
}
var file_api_lock_grpc_types_proto_depIdxs = []int32{
1, // 0: neo.fs.v2.lock.Lock.members:type_name -> neo.fs.v2.refs.ObjectID
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_api_lock_grpc_types_proto_init() }
func file_api_lock_grpc_types_proto_init() {
if File_api_lock_grpc_types_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_lock_grpc_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_api_lock_grpc_types_proto_goTypes,
DependencyIndexes: file_api_lock_grpc_types_proto_depIdxs,
MessageInfos: file_api_lock_grpc_types_proto_msgTypes,
}.Build()
File_api_lock_grpc_types_proto = out.File
file_api_lock_grpc_types_proto_rawDesc = nil
file_api_lock_grpc_types_proto_goTypes = nil
file_api_lock_grpc_types_proto_depIdxs = nil
}

View file

@ -45,24 +45,24 @@ func (f *Filter) FromGRPCMessage(m grpc.Message) error {
return nil
}
func FiltersToGRPC(fs []Filter) (res []*netmap.Filter) {
func FiltersToGRPC(fs []Filter) (res []netmap.Filter) {
if fs != nil {
res = make([]*netmap.Filter, 0, len(fs))
res = make([]netmap.Filter, 0, len(fs))
for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*netmap.Filter))
res = append(res, *fs[i].ToGRPCMessage().(*netmap.Filter))
}
}
return
}
func FiltersFromGRPC(fs []*netmap.Filter) (res []Filter, err error) {
func FiltersFromGRPC(fs []netmap.Filter) (res []Filter, err error) {
if fs != nil {
res = make([]Filter, len(fs))
for i := range fs {
err = res[i].FromGRPCMessage(fs[i])
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
@ -103,24 +103,24 @@ func (s *Selector) FromGRPCMessage(m grpc.Message) error {
return nil
}
func SelectorsToGRPC(ss []Selector) (res []*netmap.Selector) {
func SelectorsToGRPC(ss []Selector) (res []netmap.Selector) {
if ss != nil {
res = make([]*netmap.Selector, 0, len(ss))
res = make([]netmap.Selector, 0, len(ss))
for i := range ss {
res = append(res, ss[i].ToGRPCMessage().(*netmap.Selector))
res = append(res, *ss[i].ToGRPCMessage().(*netmap.Selector))
}
}
return
}
func SelectorsFromGRPC(ss []*netmap.Selector) (res []Selector, err error) {
func SelectorsFromGRPC(ss []netmap.Selector) (res []Selector, err error) {
if ss != nil {
res = make([]Selector, len(ss))
for i := range ss {
err = res[i].FromGRPCMessage(ss[i])
err = res[i].FromGRPCMessage(&ss[i])
if err != nil {
return
}
@ -138,8 +138,8 @@ func (r *Replica) ToGRPCMessage() grpc.Message {
m.SetSelector(r.selector)
m.SetCount(r.count)
m.SetEcDataCount(r.ecDataCount)
m.SetEcParityCount(r.ecParityCount)
m.EcDataCount = r.ecDataCount
m.EcParityCount = r.ecParityCount
}
return m
@ -159,24 +159,24 @@ func (r *Replica) FromGRPCMessage(m grpc.Message) error {
return nil
}
func ReplicasToGRPC(rs []Replica) (res []*netmap.Replica) {
func ReplicasToGRPC(rs []Replica) (res []netmap.Replica) {
if rs != nil {
res = make([]*netmap.Replica, 0, len(rs))
res = make([]netmap.Replica, 0, len(rs))
for i := range rs {
res = append(res, rs[i].ToGRPCMessage().(*netmap.Replica))
res = append(res, *rs[i].ToGRPCMessage().(*netmap.Replica))
}
}
return
}
func ReplicasFromGRPC(rs []*netmap.Replica) (res []Replica, err error) {
func ReplicasFromGRPC(rs []netmap.Replica) (res []Replica, err error) {
if rs != nil {
res = make([]Replica, len(rs))
for i := range rs {
err = res[i].FromGRPCMessage(rs[i])
err = res[i].FromGRPCMessage(&rs[i])
if err != nil {
return
}
@ -283,24 +283,24 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil
}
func AttributesToGRPC(as []Attribute) (res []*netmap.NodeInfo_Attribute) {
func AttributesToGRPC(as []Attribute) (res []netmap.NodeInfo_Attribute) {
if as != nil {
res = make([]*netmap.NodeInfo_Attribute, 0, len(as))
res = make([]netmap.NodeInfo_Attribute, 0, len(as))
for i := range as {
res = append(res, as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute))
res = append(res, *as[i].ToGRPCMessage().(*netmap.NodeInfo_Attribute))
}
}
return
}
func AttributesFromGRPC(as []*netmap.NodeInfo_Attribute) (res []Attribute, err error) {
func AttributesFromGRPC(as []netmap.NodeInfo_Attribute) (res []Attribute, err error) {
if as != nil {
res = make([]Attribute, len(as))
for i := range as {
err = res[i].FromGRPCMessage(as[i])
err = res[i].FromGRPCMessage(&as[i])
if err != nil {
return
}
@ -520,13 +520,13 @@ func (x *NetworkConfig) ToGRPCMessage() grpc.Message {
if x != nil {
m = new(netmap.NetworkConfig)
var ps []*netmap.NetworkConfig_Parameter
var ps []netmap.NetworkConfig_Parameter
if ln := len(x.ps); ln > 0 {
ps = make([]*netmap.NetworkConfig_Parameter, 0, ln)
ps = make([]netmap.NetworkConfig_Parameter, 0, ln)
for i := range ln {
ps = append(ps, x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
ps = append(ps, *x.ps[i].ToGRPCMessage().(*netmap.NetworkConfig_Parameter))
}
}
@ -553,7 +553,7 @@ func (x *NetworkConfig) FromGRPCMessage(m grpc.Message) error {
ps = make([]NetworkParameter, ln)
for i := range ln {
if err := ps[i].FromGRPCMessage(psV2[i]); err != nil {
if err := ps[i].FromGRPCMessage(&psV2[i]); err != nil {
return err
}
}
@ -746,10 +746,10 @@ func (x *NetMap) ToGRPCMessage() grpc.Message {
m.SetEpoch(x.epoch)
if x.nodes != nil {
nodes := make([]*netmap.NodeInfo, len(x.nodes))
nodes := make([]netmap.NodeInfo, len(x.nodes))
for i := range x.nodes {
nodes[i] = x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo)
nodes[i] = *x.nodes[i].ToGRPCMessage().(*netmap.NodeInfo)
}
m.SetNodes(nodes)
@ -774,7 +774,7 @@ func (x *NetMap) FromGRPCMessage(m grpc.Message) error {
x.nodes = make([]NodeInfo, len(nodes))
for i := range nodes {
err = x.nodes[i].FromGRPCMessage(nodes[i])
err = x.nodes[i].FromGRPCMessage(&nodes[i])
if err != nil {
return err
}

File diff suppressed because it is too large Load diff

2180
api/netmap/grpc/service_frostfs.pb.go generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,121 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
func DoFuzzProtoLocalNodeInfoRequest(data []byte) int {
msg := new(LocalNodeInfoRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONLocalNodeInfoRequest(data []byte) int {
msg := new(LocalNodeInfoRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoLocalNodeInfoResponse(data []byte) int {
msg := new(LocalNodeInfoResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONLocalNodeInfoResponse(data []byte) int {
msg := new(LocalNodeInfoResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkInfoRequest(data []byte) int {
msg := new(NetworkInfoRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkInfoRequest(data []byte) int {
msg := new(NetworkInfoRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkInfoResponse(data []byte) int {
msg := new(NetworkInfoResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkInfoResponse(data []byte) int {
msg := new(NetworkInfoResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetmapSnapshotRequest(data []byte) int {
msg := new(NetmapSnapshotRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetmapSnapshotRequest(data []byte) int {
msg := new(NetmapSnapshotRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetmapSnapshotResponse(data []byte) int {
msg := new(NetmapSnapshotResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetmapSnapshotResponse(data []byte) int {
msg := new(NetmapSnapshotResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,71 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
import (
testing "testing"
)
func FuzzProtoLocalNodeInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoLocalNodeInfoRequest(data)
})
}
func FuzzJSONLocalNodeInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONLocalNodeInfoRequest(data)
})
}
func FuzzProtoLocalNodeInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoLocalNodeInfoResponse(data)
})
}
func FuzzJSONLocalNodeInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONLocalNodeInfoResponse(data)
})
}
func FuzzProtoNetworkInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkInfoRequest(data)
})
}
func FuzzJSONNetworkInfoRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkInfoRequest(data)
})
}
func FuzzProtoNetworkInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkInfoResponse(data)
})
}
func FuzzJSONNetworkInfoResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkInfoResponse(data)
})
}
func FuzzProtoNetmapSnapshotRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetmapSnapshotRequest(data)
})
}
func FuzzJSONNetmapSnapshotRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetmapSnapshotRequest(data)
})
}
func FuzzProtoNetmapSnapshotResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetmapSnapshotResponse(data)
})
}
func FuzzJSONNetmapSnapshotResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetmapSnapshotResponse(data)
})
}

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.29.2
// - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.2
// source: api/netmap/grpc/service.proto
package netmap
@ -15,8 +15,8 @@ import (
// 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
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
NetmapService_LocalNodeInfo_FullMethodName = "/neo.fs.v2.netmap.NetmapService/LocalNodeInfo"
@ -27,11 +27,6 @@ const (
// NetmapServiceClient is the client API for NetmapService 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.
//
// `NetmapService` provides methods to work with `Network Map` and the
// information required to build it. The resulting `Network Map` is stored in
// sidechain `Netmap` smart contract, while related information can be obtained
// from other FrostFS nodes.
type NetmapServiceClient interface {
// Get NodeInfo structure from the particular node directly.
// Node information can be taken from `Netmap` smart contract. In some cases,
@ -70,9 +65,8 @@ func NewNetmapServiceClient(cc grpc.ClientConnInterface) NetmapServiceClient {
}
func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeInfoRequest, opts ...grpc.CallOption) (*LocalNodeInfoResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LocalNodeInfoResponse)
err := c.cc.Invoke(ctx, NetmapService_LocalNodeInfo_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, NetmapService_LocalNodeInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -80,9 +74,8 @@ func (c *netmapServiceClient) LocalNodeInfo(ctx context.Context, in *LocalNodeIn
}
func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NetworkInfoResponse)
err := c.cc.Invoke(ctx, NetmapService_NetworkInfo_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, NetmapService_NetworkInfo_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -90,9 +83,8 @@ func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRe
}
func (c *netmapServiceClient) NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NetmapSnapshotResponse)
err := c.cc.Invoke(ctx, NetmapService_NetmapSnapshot_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, NetmapService_NetmapSnapshot_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -101,12 +93,7 @@ func (c *netmapServiceClient) NetmapSnapshot(ctx context.Context, in *NetmapSnap
// NetmapServiceServer is the server API for NetmapService service.
// All implementations should embed UnimplementedNetmapServiceServer
// for forward compatibility.
//
// `NetmapService` provides methods to work with `Network Map` and the
// information required to build it. The resulting `Network Map` is stored in
// sidechain `Netmap` smart contract, while related information can be obtained
// from other FrostFS nodes.
// for forward compatibility
type NetmapServiceServer interface {
// Get NodeInfo structure from the particular node directly.
// Node information can be taken from `Netmap` smart contract. In some cases,
@ -136,12 +123,9 @@ type NetmapServiceServer interface {
NetmapSnapshot(context.Context, *NetmapSnapshotRequest) (*NetmapSnapshotResponse, error)
}
// UnimplementedNetmapServiceServer should 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 UnimplementedNetmapServiceServer struct{}
// UnimplementedNetmapServiceServer should be embedded to have forward compatible implementations.
type UnimplementedNetmapServiceServer struct {
}
func (UnimplementedNetmapServiceServer) LocalNodeInfo(context.Context, *LocalNodeInfoRequest) (*LocalNodeInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LocalNodeInfo not implemented")
@ -152,7 +136,6 @@ func (UnimplementedNetmapServiceServer) NetworkInfo(context.Context, *NetworkInf
func (UnimplementedNetmapServiceServer) NetmapSnapshot(context.Context, *NetmapSnapshotRequest) (*NetmapSnapshotResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NetmapSnapshot not implemented")
}
func (UnimplementedNetmapServiceServer) testEmbeddedByValue() {}
// UnsafeNetmapServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to NetmapServiceServer will
@ -162,13 +145,6 @@ type UnsafeNetmapServiceServer interface {
}
func RegisterNetmapServiceServer(s grpc.ServiceRegistrar, srv NetmapServiceServer) {
// If the following call pancis, it indicates UnimplementedNetmapServiceServer 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(&NetmapService_ServiceDesc, srv)
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

2749
api/netmap/grpc/types_frostfs.pb.go generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,159 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
func DoFuzzProtoFilter(data []byte) int {
msg := new(Filter)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONFilter(data []byte) int {
msg := new(Filter)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSelector(data []byte) int {
msg := new(Selector)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSelector(data []byte) int {
msg := new(Selector)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoReplica(data []byte) int {
msg := new(Replica)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONReplica(data []byte) int {
msg := new(Replica)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPlacementPolicy(data []byte) int {
msg := new(PlacementPolicy)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPlacementPolicy(data []byte) int {
msg := new(PlacementPolicy)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNodeInfo(data []byte) int {
msg := new(NodeInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNodeInfo(data []byte) int {
msg := new(NodeInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetmap(data []byte) int {
msg := new(Netmap)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetmap(data []byte) int {
msg := new(Netmap)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkConfig(data []byte) int {
msg := new(NetworkConfig)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkConfig(data []byte) int {
msg := new(NetworkConfig)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoNetworkInfo(data []byte) int {
msg := new(NetworkInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONNetworkInfo(data []byte) int {
msg := new(NetworkInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,91 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package netmap
import (
testing "testing"
)
func FuzzProtoFilter(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoFilter(data)
})
}
func FuzzJSONFilter(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONFilter(data)
})
}
func FuzzProtoSelector(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSelector(data)
})
}
func FuzzJSONSelector(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSelector(data)
})
}
func FuzzProtoReplica(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoReplica(data)
})
}
func FuzzJSONReplica(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONReplica(data)
})
}
func FuzzProtoPlacementPolicy(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPlacementPolicy(data)
})
}
func FuzzJSONPlacementPolicy(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPlacementPolicy(data)
})
}
func FuzzProtoNodeInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNodeInfo(data)
})
}
func FuzzJSONNodeInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNodeInfo(data)
})
}
func FuzzProtoNetmap(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetmap(data)
})
}
func FuzzJSONNetmap(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetmap(data)
})
}
func FuzzProtoNetworkConfig(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkConfig(data)
})
}
func FuzzJSONNetworkConfig(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkConfig(data)
})
}
func FuzzProtoNetworkInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoNetworkInfo(data)
})
}
func FuzzJSONNetworkInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONNetworkInfo(data)
})
}

File diff suppressed because it is too large Load diff

View file

@ -14,10 +14,12 @@ func (x Clause) String() string {
//
// Returns true if s was parsed successfully.
func (x *Clause) FromString(s string) bool {
g, ok := netmap.Clause_value[s]
var g netmap.Clause
ok := g.FromString(s)
if ok {
*x = ClauseFromGRPCMessage(netmap.Clause(g))
*x = ClauseFromGRPCMessage(g)
}
return ok
@ -33,10 +35,12 @@ func (x Operation) String() string {
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
g, ok := netmap.Operation_value[s]
var g netmap.Operation
ok := g.FromString(s)
if ok {
*x = OperationFromGRPCMessage(netmap.Operation(g))
*x = OperationFromGRPCMessage(g)
}
return ok
@ -52,10 +56,12 @@ func (x NodeState) String() string {
//
// Returns true if s was parsed successfully.
func (x *NodeState) FromString(s string) bool {
g, ok := netmap.NodeInfo_State_value[s]
var g netmap.NodeInfo_State
ok := g.FromString(s)
if ok {
*x = NodeStateFromRPCMessage(netmap.NodeInfo_State(g))
*x = NodeStateFromRPCMessage(g)
}
return ok

View file

@ -142,24 +142,24 @@ func (a *Attribute) FromGRPCMessage(m grpc.Message) error {
return nil
}
func AttributesToGRPC(xs []Attribute) (res []*object.Header_Attribute) {
func AttributesToGRPC(xs []Attribute) (res []object.Header_Attribute) {
if xs != nil {
res = make([]*object.Header_Attribute, 0, len(xs))
res = make([]object.Header_Attribute, 0, len(xs))
for i := range xs {
res = append(res, xs[i].ToGRPCMessage().(*object.Header_Attribute))
res = append(res, *xs[i].ToGRPCMessage().(*object.Header_Attribute))
}
}
return
}
func AttributesFromGRPC(xs []*object.Header_Attribute) (res []Attribute, err error) {
func AttributesFromGRPC(xs []object.Header_Attribute) (res []Attribute, err error) {
if xs != nil {
res = make([]Attribute, len(xs))
for i := range xs {
err = res[i].FromGRPCMessage(xs[i])
err = res[i].FromGRPCMessage(&xs[i])
if err != nil {
return
}
@ -266,14 +266,14 @@ func (h *ECHeader) ToGRPCMessage() grpc.Message {
if h != nil {
m = new(object.Header_EC)
m.SetParent(h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID))
m.SetParentSplitId(h.ParentSplitID)
m.SetParentSplitParentId(h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID))
m.SetParentAttributes(AttributesToGRPC(h.ParentAttributes))
m.SetIndex(h.Index)
m.SetTotal(h.Total)
m.SetHeader(h.Header)
m.SetHeaderLength(h.HeaderLength)
m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID)
m.ParentSplitId = h.ParentSplitID
m.ParentSplitParentId = h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID)
m.ParentAttributes = AttributesToGRPC(h.ParentAttributes)
m.Index = h.Index
m.Total = h.Total
m.Header = h.Header
m.HeaderLength = h.HeaderLength
}
return m
@ -681,9 +681,9 @@ func (s *ECInfo) ToGRPCMessage() grpc.Message {
m = new(object.ECInfo)
if s.Chunks != nil {
chunks := make([]*object.ECInfo_Chunk, len(s.Chunks))
chunks := make([]object.ECInfo_Chunk, len(s.Chunks))
for i := range chunks {
chunks[i] = s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk)
chunks[i] = *s.Chunks[i].ToGRPCMessage().(*object.ECInfo_Chunk)
}
m.Chunks = chunks
}
@ -704,7 +704,7 @@ func (s *ECInfo) FromGRPCMessage(m grpc.Message) error {
} else {
s.Chunks = make([]ECChunk, len(chunks))
for i := range chunks {
if err := s.Chunks[i].FromGRPCMessage(chunks[i]); err != nil {
if err := s.Chunks[i].FromGRPCMessage(&chunks[i]); err != nil {
return err
}
}
@ -718,9 +718,9 @@ func (c *ECChunk) ToGRPCMessage() grpc.Message {
if c != nil {
m = new(object.ECInfo_Chunk)
m.SetTotal(c.Total)
m.SetIndex(c.Index)
m.SetId(c.ID.ToGRPCMessage().(*refsGRPC.ObjectID))
m.Total = c.Total
m.Index = c.Index
m.Id = c.ID.ToGRPCMessage().(*refsGRPC.ObjectID)
}
return m
@ -735,8 +735,8 @@ func (c *ECChunk) FromGRPCMessage(m grpc.Message) error {
if err := c.ID.FromGRPCMessage(v.GetId()); err != nil {
return err
}
c.Index = v.GetIndex()
c.Total = v.GetTotal()
c.Index = v.Index
c.Total = v.Total
return nil
}
@ -888,7 +888,8 @@ func (r *GetObjectPartChunk) ToGRPCMessage() grpc.Message {
if r != nil {
m = new(object.GetResponse_Body_Chunk)
m.Chunk = r.chunk
m.SetChunk(r.chunk)
}
return m
@ -900,7 +901,7 @@ func (r *GetObjectPartChunk) FromGRPCMessage(m grpc.Message) error {
return message.NewUnexpectedMessageType(m, v)
}
r.chunk = v.Chunk
r.chunk = v.GetChunk()
return nil
}
@ -917,7 +918,7 @@ func (r *GetResponseBody) ToGRPCMessage() grpc.Message {
case *GetObjectPartInit:
m.SetInit(t.ToGRPCMessage().(*object.GetResponse_Body_Init))
case *GetObjectPartChunk:
m.SetChunk(t.ToGRPCMessage().(*object.GetResponse_Body_Chunk).Chunk)
m.SetChunk(t.ToGRPCMessage().(*object.GetResponse_Body_Chunk))
case *SplitInfo:
m.SetSplitInfo(t.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:
@ -1087,7 +1088,7 @@ func (r *PutObjectPartChunk) ToGRPCMessage() grpc.Message {
if r != nil {
m = new(object.PutRequest_Body_Chunk)
m.Chunk = r.chunk
m.SetChunk(r.chunk)
}
return m
@ -1099,7 +1100,7 @@ func (r *PutObjectPartChunk) FromGRPCMessage(m grpc.Message) error {
return message.NewUnexpectedMessageType(m, v)
}
r.chunk = v.Chunk
r.chunk = v.GetChunk()
return nil
}
@ -1116,7 +1117,7 @@ func (r *PutRequestBody) ToGRPCMessage() grpc.Message {
case *PutObjectPartInit:
m.SetInit(t.ToGRPCMessage().(*object.PutRequest_Body_Init))
case *PutObjectPartChunk:
m.SetChunk(t.ToGRPCMessage().(*object.PutRequest_Body_Chunk).Chunk)
m.SetChunk(t.ToGRPCMessage().(*object.PutRequest_Body_Chunk))
default:
panic(fmt.Sprintf("unknown put object part %T", t))
}
@ -1623,24 +1624,24 @@ func (f *SearchFilter) FromGRPCMessage(m grpc.Message) error {
return nil
}
func SearchFiltersToGRPC(fs []SearchFilter) (res []*object.SearchRequest_Body_Filter) {
func SearchFiltersToGRPC(fs []SearchFilter) (res []object.SearchRequest_Body_Filter) {
if fs != nil {
res = make([]*object.SearchRequest_Body_Filter, 0, len(fs))
res = make([]object.SearchRequest_Body_Filter, 0, len(fs))
for i := range fs {
res = append(res, fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter))
res = append(res, *fs[i].ToGRPCMessage().(*object.SearchRequest_Body_Filter))
}
}
return
}
func SearchFiltersFromGRPC(fs []*object.SearchRequest_Body_Filter) (res []SearchFilter, err error) {
func SearchFiltersFromGRPC(fs []object.SearchRequest_Body_Filter) (res []SearchFilter, err error) {
if fs != nil {
res = make([]SearchFilter, len(fs))
for i := range fs {
err = res[i].FromGRPCMessage(fs[i])
err = res[i].FromGRPCMessage(&fs[i])
if err != nil {
return
}
@ -1822,24 +1823,24 @@ func (r *Range) FromGRPCMessage(m grpc.Message) error {
return nil
}
func RangesToGRPC(rs []Range) (res []*object.Range) {
func RangesToGRPC(rs []Range) (res []object.Range) {
if rs != nil {
res = make([]*object.Range, 0, len(rs))
res = make([]object.Range, 0, len(rs))
for i := range rs {
res = append(res, rs[i].ToGRPCMessage().(*object.Range))
res = append(res, *rs[i].ToGRPCMessage().(*object.Range))
}
}
return
}
func RangesFromGRPC(rs []*object.Range) (res []Range, err error) {
func RangesFromGRPC(rs []object.Range) (res []Range, err error) {
if rs != nil {
res = make([]Range, len(rs))
for i := range rs {
err = res[i].FromGRPCMessage(rs[i])
err = res[i].FromGRPCMessage(&rs[i])
if err != nil {
return
}
@ -1948,7 +1949,7 @@ func (r *GetRangePartChunk) ToGRPCMessage() grpc.Message {
if r != nil {
m = new(object.GetRangeResponse_Body_Chunk)
m.Chunk = r.chunk
m.SetChunk(r.chunk)
}
return m
@ -1960,7 +1961,7 @@ func (r *GetRangePartChunk) FromGRPCMessage(m grpc.Message) error {
return message.NewUnexpectedMessageType(m, v)
}
r.chunk = v.Chunk
r.chunk = v.GetChunk()
return nil
}
@ -1975,7 +1976,7 @@ func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message {
case nil:
m.RangePart = nil
case *GetRangePartChunk:
m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk).Chunk)
m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk))
case *SplitInfo:
m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:

File diff suppressed because it is too large Load diff

9389
api/object/grpc/service_frostfs.pb.go generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,387 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
func DoFuzzProtoGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRequest(data []byte) int {
msg := new(GetRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetResponse(data []byte) int {
msg := new(GetResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutRequest(data []byte) int {
msg := new(PutRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutResponse(data []byte) int {
msg := new(PutResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteRequest(data []byte) int {
msg := new(DeleteRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONDeleteResponse(data []byte) int {
msg := new(DeleteResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeadRequest(data []byte) int {
msg := new(HeadRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeadRequest(data []byte) int {
msg := new(HeadRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeaderWithSignature(data []byte) int {
msg := new(HeaderWithSignature)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeaderWithSignature(data []byte) int {
msg := new(HeaderWithSignature)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeadResponse(data []byte) int {
msg := new(HeadResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeadResponse(data []byte) int {
msg := new(HeadResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSearchRequest(data []byte) int {
msg := new(SearchRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSearchRequest(data []byte) int {
msg := new(SearchRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSearchResponse(data []byte) int {
msg := new(SearchResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSearchResponse(data []byte) int {
msg := new(SearchResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoRange(data []byte) int {
msg := new(Range)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONRange(data []byte) int {
msg := new(Range)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeRequest(data []byte) int {
msg := new(GetRangeRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeRequest(data []byte) int {
msg := new(GetRangeRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeResponse(data []byte) int {
msg := new(GetRangeResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeResponse(data []byte) int {
msg := new(GetRangeResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeHashRequest(data []byte) int {
msg := new(GetRangeHashRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeHashRequest(data []byte) int {
msg := new(GetRangeHashRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetRangeHashResponse(data []byte) int {
msg := new(GetRangeHashResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetRangeHashResponse(data []byte) int {
msg := new(GetRangeHashResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutSingleRequest(data []byte) int {
msg := new(PutSingleRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutSingleRequest(data []byte) int {
msg := new(PutSingleRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPutSingleResponse(data []byte) int {
msg := new(PutSingleResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPutSingleResponse(data []byte) int {
msg := new(PutSingleResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPatchRequest(data []byte) int {
msg := new(PatchRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPatchRequest(data []byte) int {
msg := new(PatchRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoPatchResponse(data []byte) int {
msg := new(PatchResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONPatchResponse(data []byte) int {
msg := new(PatchResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,211 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
import (
testing "testing"
)
func FuzzProtoGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRequest(data)
})
}
func FuzzJSONGetRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRequest(data)
})
}
func FuzzProtoGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetResponse(data)
})
}
func FuzzJSONGetResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetResponse(data)
})
}
func FuzzProtoPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutRequest(data)
})
}
func FuzzJSONPutRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutRequest(data)
})
}
func FuzzProtoPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutResponse(data)
})
}
func FuzzJSONPutResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutResponse(data)
})
}
func FuzzProtoDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteRequest(data)
})
}
func FuzzJSONDeleteRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteRequest(data)
})
}
func FuzzProtoDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoDeleteResponse(data)
})
}
func FuzzJSONDeleteResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONDeleteResponse(data)
})
}
func FuzzProtoHeadRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeadRequest(data)
})
}
func FuzzJSONHeadRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeadRequest(data)
})
}
func FuzzProtoHeaderWithSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeaderWithSignature(data)
})
}
func FuzzJSONHeaderWithSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeaderWithSignature(data)
})
}
func FuzzProtoHeadResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeadResponse(data)
})
}
func FuzzJSONHeadResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeadResponse(data)
})
}
func FuzzProtoSearchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSearchRequest(data)
})
}
func FuzzJSONSearchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSearchRequest(data)
})
}
func FuzzProtoSearchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSearchResponse(data)
})
}
func FuzzJSONSearchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSearchResponse(data)
})
}
func FuzzProtoRange(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoRange(data)
})
}
func FuzzJSONRange(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONRange(data)
})
}
func FuzzProtoGetRangeRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeRequest(data)
})
}
func FuzzJSONGetRangeRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeRequest(data)
})
}
func FuzzProtoGetRangeResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeResponse(data)
})
}
func FuzzJSONGetRangeResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeResponse(data)
})
}
func FuzzProtoGetRangeHashRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeHashRequest(data)
})
}
func FuzzJSONGetRangeHashRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeHashRequest(data)
})
}
func FuzzProtoGetRangeHashResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetRangeHashResponse(data)
})
}
func FuzzJSONGetRangeHashResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetRangeHashResponse(data)
})
}
func FuzzProtoPutSingleRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutSingleRequest(data)
})
}
func FuzzJSONPutSingleRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutSingleRequest(data)
})
}
func FuzzProtoPutSingleResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPutSingleResponse(data)
})
}
func FuzzJSONPutSingleResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPutSingleResponse(data)
})
}
func FuzzProtoPatchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPatchRequest(data)
})
}
func FuzzJSONPatchRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPatchRequest(data)
})
}
func FuzzProtoPatchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoPatchResponse(data)
})
}
func FuzzJSONPatchResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONPatchResponse(data)
})
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

2992
api/object/grpc/types_frostfs.pb.go generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,102 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
func DoFuzzProtoShortHeader(data []byte) int {
msg := new(ShortHeader)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONShortHeader(data []byte) int {
msg := new(ShortHeader)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoHeader(data []byte) int {
msg := new(Header)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONHeader(data []byte) int {
msg := new(Header)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoObject(data []byte) int {
msg := new(Object)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONObject(data []byte) int {
msg := new(Object)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSplitInfo(data []byte) int {
msg := new(SplitInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSplitInfo(data []byte) int {
msg := new(SplitInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoECInfo(data []byte) int {
msg := new(ECInfo)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONECInfo(data []byte) int {
msg := new(ECInfo)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,61 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package object
import (
testing "testing"
)
func FuzzProtoShortHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoShortHeader(data)
})
}
func FuzzJSONShortHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONShortHeader(data)
})
}
func FuzzProtoHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoHeader(data)
})
}
func FuzzJSONHeader(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONHeader(data)
})
}
func FuzzProtoObject(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoObject(data)
})
}
func FuzzJSONObject(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONObject(data)
})
}
func FuzzProtoSplitInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSplitInfo(data)
})
}
func FuzzJSONSplitInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSplitInfo(data)
})
}
func FuzzProtoECInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoECInfo(data)
})
}
func FuzzJSONECInfo(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONECInfo(data)
})
}

File diff suppressed because it is too large Load diff

View file

@ -89,13 +89,13 @@ func (x *Lock) ToGRPCMessage() grpc.Message {
if x != nil {
m = new(lock.Lock)
var members []*refsGRPC.ObjectID
var members []refsGRPC.ObjectID
if x.members != nil {
members = make([]*refsGRPC.ObjectID, len(x.members))
members = make([]refsGRPC.ObjectID, len(x.members))
for i := range x.members {
members[i] = x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID)
members[i] = *x.members[i].ToGRPCMessage().(*refsGRPC.ObjectID)
}
}
@ -119,7 +119,7 @@ func (x *Lock) FromGRPCMessage(m grpc.Message) error {
var err error
for i := range x.members {
err = x.members[i].FromGRPCMessage(members[i])
err = x.members[i].FromGRPCMessage(&members[i])
if err != nil {
return err
}

View file

@ -14,10 +14,12 @@ func (t Type) String() string {
//
// Returns true if s was parsed successfully.
func (t *Type) FromString(s string) bool {
g, ok := object.ObjectType_value[s]
var g object.ObjectType
ok := g.FromString(s)
if ok {
*t = TypeFromGRPCField(object.ObjectType(g))
*t = TypeFromGRPCField(g)
}
return ok
@ -41,10 +43,12 @@ func (t MatchType) String() string {
//
// Returns true if s was parsed successfully.
func (t *MatchType) FromString(s string) bool {
g, ok := object.MatchType_value[s]
var g object.MatchType
ok := g.FromString(s)
if ok {
*t = MatchTypeFromGRPCField(object.MatchType(g))
*t = MatchTypeFromGRPCField(g)
}
return ok

View file

@ -52,24 +52,24 @@ func (c *ContainerID) FromGRPCMessage(m grpc.Message) error {
return nil
}
func ContainerIDsToGRPCMessage(ids []ContainerID) (res []*refs.ContainerID) {
func ContainerIDsToGRPCMessage(ids []ContainerID) (res []refs.ContainerID) {
if ids != nil {
res = make([]*refs.ContainerID, 0, len(ids))
res = make([]refs.ContainerID, 0, len(ids))
for i := range ids {
res = append(res, ids[i].ToGRPCMessage().(*refs.ContainerID))
res = append(res, *ids[i].ToGRPCMessage().(*refs.ContainerID))
}
}
return
}
func ContainerIDsFromGRPCMessage(idsV2 []*refs.ContainerID) (res []ContainerID, err error) {
func ContainerIDsFromGRPCMessage(idsV2 []refs.ContainerID) (res []ContainerID, err error) {
if idsV2 != nil {
res = make([]ContainerID, len(idsV2))
for i := range idsV2 {
err = res[i].FromGRPCMessage(idsV2[i])
err = res[i].FromGRPCMessage(&idsV2[i])
if err != nil {
return
}
@ -102,24 +102,24 @@ func (o *ObjectID) FromGRPCMessage(m grpc.Message) error {
return nil
}
func ObjectIDListToGRPCMessage(ids []ObjectID) (res []*refs.ObjectID) {
func ObjectIDListToGRPCMessage(ids []ObjectID) (res []refs.ObjectID) {
if ids != nil {
res = make([]*refs.ObjectID, 0, len(ids))
res = make([]refs.ObjectID, 0, len(ids))
for i := range ids {
res = append(res, ids[i].ToGRPCMessage().(*refs.ObjectID))
res = append(res, *ids[i].ToGRPCMessage().(*refs.ObjectID))
}
}
return
}
func ObjectIDListFromGRPCMessage(idsV2 []*refs.ObjectID) (res []ObjectID, err error) {
func ObjectIDListFromGRPCMessage(idsV2 []refs.ObjectID) (res []ObjectID, err error) {
if idsV2 != nil {
res = make([]ObjectID, len(idsV2))
for i := range idsV2 {
err = res[i].FromGRPCMessage(idsV2[i])
err = res[i].FromGRPCMessage(&idsV2[i])
if err != nil {
return
}

1043
api/refs/grpc/types.pb.go generated

File diff suppressed because it is too large Load diff

1527
api/refs/grpc/types_frostfs.pb.go generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,159 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package refs
func DoFuzzProtoAddress(data []byte) int {
msg := new(Address)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONAddress(data []byte) int {
msg := new(Address)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoObjectID(data []byte) int {
msg := new(ObjectID)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONObjectID(data []byte) int {
msg := new(ObjectID)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoContainerID(data []byte) int {
msg := new(ContainerID)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONContainerID(data []byte) int {
msg := new(ContainerID)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoOwnerID(data []byte) int {
msg := new(OwnerID)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONOwnerID(data []byte) int {
msg := new(OwnerID)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoVersion(data []byte) int {
msg := new(Version)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONVersion(data []byte) int {
msg := new(Version)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSignature(data []byte) int {
msg := new(Signature)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSignature(data []byte) int {
msg := new(Signature)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoSignatureRFC6979(data []byte) int {
msg := new(SignatureRFC6979)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONSignatureRFC6979(data []byte) int {
msg := new(SignatureRFC6979)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoChecksum(data []byte) int {
msg := new(Checksum)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONChecksum(data []byte) int {
msg := new(Checksum)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,91 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package refs
import (
testing "testing"
)
func FuzzProtoAddress(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoAddress(data)
})
}
func FuzzJSONAddress(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONAddress(data)
})
}
func FuzzProtoObjectID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoObjectID(data)
})
}
func FuzzJSONObjectID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONObjectID(data)
})
}
func FuzzProtoContainerID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoContainerID(data)
})
}
func FuzzJSONContainerID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONContainerID(data)
})
}
func FuzzProtoOwnerID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoOwnerID(data)
})
}
func FuzzJSONOwnerID(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONOwnerID(data)
})
}
func FuzzProtoVersion(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoVersion(data)
})
}
func FuzzJSONVersion(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONVersion(data)
})
}
func FuzzProtoSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSignature(data)
})
}
func FuzzJSONSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSignature(data)
})
}
func FuzzProtoSignatureRFC6979(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoSignatureRFC6979(data)
})
}
func FuzzJSONSignatureRFC6979(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONSignatureRFC6979(data)
})
}
func FuzzProtoChecksum(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoChecksum(data)
})
}
func FuzzJSONChecksum(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONChecksum(data)
})
}

File diff suppressed because it is too large Load diff

View file

@ -14,10 +14,12 @@ func (t ChecksumType) String() string {
//
// Returns true if s was parsed successfully.
func (t *ChecksumType) FromString(s string) bool {
g, ok := refs.ChecksumType_value[s]
var g refs.ChecksumType
ok := g.FromString(s)
if ok {
*t = ChecksumTypeFromGRPC(refs.ChecksumType(g))
*t = ChecksumTypeFromGRPC(g)
}
return ok
@ -33,10 +35,12 @@ func (t SignatureScheme) String() string {
//
// Returns true if s was parsed successfully.
func (t *SignatureScheme) FromString(s string) bool {
g, ok := refs.SignatureScheme_value[s]
var g refs.SignatureScheme
ok := g.FromString(s)
if ok {
*t = SignatureScheme(refs.SignatureScheme(g))
*t = SignatureScheme(g)
}
return ok

View file

@ -12,20 +12,18 @@ import (
// SendUnary initializes communication session by RPC info, performs unary RPC
// and closes the session.
func SendUnary(cli *Client, info common.CallMethodInfo, req, resp message.Message, opts ...CallOption) error {
rw, err := cli.initInternal(info, opts...)
rw, err := cli.Init(info, opts...)
if err != nil {
return err
}
err = rw.WriteMessage(req)
if err != nil {
rw.cancel()
return err
}
err = rw.ReadMessage(resp)
if err != nil {
rw.cancel()
return err
}
@ -40,28 +38,18 @@ type MessageWriterCloser interface {
}
type clientStreamWriterCloser struct {
sw *streamWrapper
MessageReadWriter
resp message.Message
}
// WriteMessage implements MessageWriterCloser.
func (c *clientStreamWriterCloser) WriteMessage(m message.Message) error {
return c.sw.WriteMessage(m)
}
func (c *clientStreamWriterCloser) Close() error {
err := c.sw.closeSend()
err := c.MessageReadWriter.Close()
if err != nil {
c.sw.cancel()
return err
}
if err = c.sw.ReadMessage(c.resp); err != nil {
c.sw.cancel()
return err
}
return c.sw.Close()
return c.ReadMessage(c.resp)
}
// OpenClientStream initializes communication session by RPC info, opens client-side stream
@ -69,14 +57,14 @@ func (c *clientStreamWriterCloser) Close() error {
//
// All stream writes must be performed before the closing. Close must be called once.
func OpenClientStream(cli *Client, info common.CallMethodInfo, resp message.Message, opts ...CallOption) (MessageWriterCloser, error) {
rw, err := cli.initInternal(info, opts...)
rw, err := cli.Init(info, opts...)
if err != nil {
return nil, err
}
return &clientStreamWriterCloser{
sw: rw,
resp: resp,
MessageReadWriter: rw,
resp: resp,
}, nil
}
@ -88,7 +76,7 @@ type MessageReaderCloser interface {
}
type serverStreamReaderCloser struct {
rw *streamWrapper
rw MessageReadWriter
once sync.Once
@ -103,15 +91,11 @@ func (s *serverStreamReaderCloser) ReadMessage(msg message.Message) error {
})
if err != nil {
s.rw.cancel()
return err
}
err = s.rw.ReadMessage(msg)
if !errors.Is(err, io.EOF) {
if err != nil {
s.rw.cancel()
}
return err
}
@ -128,7 +112,7 @@ func (s *serverStreamReaderCloser) ReadMessage(msg message.Message) error {
//
// All stream reads must be performed before the closing. Close must be called once.
func OpenServerStream(cli *Client, info common.CallMethodInfo, req message.Message, opts ...CallOption) (MessageReader, error) {
rw, err := cli.initInternal(info, opts...)
rw, err := cli.Init(info, opts...)
if err != nil {
return nil, err
}

View file

@ -3,7 +3,6 @@ package client
import (
"context"
"io"
"time"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/message"
@ -41,10 +40,6 @@ type MessageReadWriter interface {
// Init initiates a messaging session and returns the interface for message transmitting.
func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageReadWriter, error) {
return c.initInternal(info, opts...)
}
func (c *Client) initInternal(info common.CallMethodInfo, opts ...CallOption) (*streamWrapper, error) {
prm := defaultCallParameters()
for _, opt := range opts {
@ -56,62 +51,18 @@ func (c *Client) initInternal(info common.CallMethodInfo, opts ...CallOption) (*
}
ctx, cancel := context.WithCancel(prm.ctx)
// `conn.NewStream` doesn't check if `conn` may turn up invalidated right before this invocation.
// In such cases, the operation can hang indefinitely, with the context timeout being the only
// mechanism to cancel it.
//
// We use a separate timer instead of context timeout because the latter
// would propagate to all subsequent read/write operations on the opened stream,
// which is not desired for the stream's lifecycle management.
dialTimeoutTimer := time.NewTimer(c.dialTimeout)
defer func() {
dialTimeoutTimer.Stop()
select {
case <-dialTimeoutTimer.C:
default:
}
}()
type newStreamRes struct {
stream grpc.ClientStream
err error
}
newStreamCh := make(chan newStreamRes)
go func() {
stream, err := c.conn.NewStream(ctx, &grpc.StreamDesc{
StreamName: info.Name,
ServerStreams: info.ServerStream(),
ClientStreams: info.ClientStream(),
}, toMethodName(info))
newStreamCh <- newStreamRes{
stream: stream,
err: err,
}
}()
var res newStreamRes
select {
case <-dialTimeoutTimer.C:
stream, err := c.conn.NewStream(ctx, &grpc.StreamDesc{
StreamName: info.Name,
ServerStreams: info.ServerStream(),
ClientStreams: info.ClientStream(),
}, toMethodName(info))
if err != nil {
cancel()
res = <-newStreamCh
if res.stream != nil && res.err == nil {
_ = res.stream.CloseSend()
}
return nil, context.Canceled
case res = <-newStreamCh:
}
if res.err != nil {
cancel()
return nil, res.err
return nil, err
}
return &streamWrapper{
ClientStream: res.stream,
ClientStream: stream,
cancel: cancel,
timeout: c.rwTimeout,
}, nil

View file

@ -34,13 +34,8 @@ func (w streamWrapper) WriteMessage(m message.Message) error {
})
}
func (w *streamWrapper) closeSend() error {
return w.withTimeout(w.ClientStream.CloseSend)
}
func (w *streamWrapper) Close() error {
w.cancel()
return nil
return w.withTimeout(w.ClientStream.CloseSend)
}
func (w *streamWrapper) withTimeout(closure func() error) error {
@ -55,10 +50,6 @@ func (w *streamWrapper) withTimeout(closure func() error) error {
select {
case err := <-ch:
tt.Stop()
select {
case <-tt.C:
default:
}
return err
case <-tt.C:
w.cancel()

View file

@ -13,7 +13,6 @@ const (
rpcContainerGet = "Get"
rpcContainerDel = "Delete"
rpcContainerList = "List"
rpcContainerStream = "ListStream"
rpcContainerGetEACL = "GetExtendedACL"
rpcContainerUsedSpace = "AnnounceUsedSpace"
)
@ -81,27 +80,3 @@ func ListContainers(
return resp, nil
}
type ListStreamResponseReader struct {
r client.MessageReader
}
func (r *ListStreamResponseReader) Read(resp *container.ListStreamResponse) error {
return r.r.ReadMessage(resp)
}
// ListContainersStream executes ContainerService.ListStream RPC.
func ListContainersStream(
cli *client.Client,
req *container.ListStreamRequest,
opts ...client.CallOption,
) (*ListStreamResponseReader, error) {
wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceContainer, rpcContainerStream), req, opts...)
if err != nil {
return nil, err
}
return &ListStreamResponseReader{
r: wc,
}, nil
}

View file

@ -1,17 +1,14 @@
package message
import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"encoding/json"
)
// GRPCConvertedMessage is an interface
// of the gRPC message that is used
// for Message encoding/decoding.
type GRPCConvertedMessage interface {
grpc.Message
proto.Message
UnmarshalProtobuf([]byte) error
}
// Unmarshal decodes m from its Protobuf binary representation
@ -19,7 +16,7 @@ type GRPCConvertedMessage interface {
//
// gm should be tof the same type as the m.ToGRPCMessage() return.
func Unmarshal(m Message, data []byte, gm GRPCConvertedMessage) error {
if err := proto.Unmarshal(data, gm); err != nil {
if err := gm.UnmarshalProtobuf(data); err != nil {
return err
}
@ -28,21 +25,16 @@ func Unmarshal(m Message, data []byte, gm GRPCConvertedMessage) error {
// MarshalJSON encodes m to Protobuf JSON representation.
func MarshalJSON(m Message) ([]byte, error) {
return protojson.MarshalOptions{
EmitUnpopulated: true,
}.Marshal(
m.ToGRPCMessage().(proto.Message),
)
return json.Marshal(m.ToGRPCMessage())
}
// UnmarshalJSON decodes m from its Protobuf JSON representation
// via related gRPC message.
//
// gm should be tof the same type as the m.ToGRPCMessage() return.
func UnmarshalJSON(m Message, data []byte, gm GRPCConvertedMessage) error {
if err := protojson.Unmarshal(data, gm); err != nil {
func UnmarshalJSON(m Message, data []byte, gm any) error {
if err := json.Unmarshal(data, gm); err != nil {
return err
}
return m.FromGRPCMessage(gm)
}

View file

@ -70,7 +70,6 @@ func TestRPCMessage(t *testing.T, msgGens ...func(empty bool) message.Message) {
})
}
t.Run("compatibility", func(t *testing.T) {
t.Skip()
testCompatibility(t, msgGen)
})
})

View file

@ -1,178 +0,0 @@
package rpc
import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/common"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tree"
)
const serviceTree = "tree.TreeService"
const (
rpcTreeAdd = "Add"
rpcTreeAddByPath = "AddByPath"
rpcTreeRemove = "Remove"
rpcTreeMove = "Move"
rpcTreeGetNodeByPath = "GetNodeByPath"
rpcTreeGetSubTree = "GetSubTree"
rpcTreeList = "TreeList"
rpcTreeApply = "Apply"
rpcTreeGetOpLog = "GetOpLog"
rpcTreeHealthcheck = "Healthcheck"
)
func Add(
cli *client.Client,
req *tree.AddRequest,
opts ...client.CallOption,
) (*tree.AddResponse, error) {
resp := new(tree.AddResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeAdd), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func AddByPath(
cli *client.Client,
req *tree.AddByPathRequest,
opts ...client.CallOption,
) (*tree.AddByPathResponse, error) {
resp := new(tree.AddByPathResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeAddByPath), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func Remove(cli *client.Client,
req *tree.RemoveRequest,
opts ...client.CallOption,
) (*tree.RemoveResponse, error) {
resp := new(tree.RemoveResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeRemove), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func Move(cli *client.Client,
req *tree.MoveRequest,
opts ...client.CallOption,
) (*tree.MoveResponse, error) {
resp := new(tree.MoveResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeMove), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func GetNodeByPath(cli *client.Client,
req *tree.GetNodeByPathRequest,
opts ...client.CallOption,
) (*tree.GetNodeByPathResponse, error) {
resp := new(tree.GetNodeByPathResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeGetNodeByPath), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
type GetSubTreeResponseReader struct {
r client.MessageReader
}
// Read reads response from the stream.
//
// Returns io.EOF of streaming is finished.
func (r *GetSubTreeResponseReader) Read(resp *tree.GetSubTreeResponse) error {
return r.r.ReadMessage(resp)
}
func GetSubTree(cli *client.Client,
req *tree.GetSubTreeRequest,
opts ...client.CallOption,
) (*GetSubTreeResponseReader, error) {
wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceTree, rpcTreeGetSubTree), req, opts...)
if err != nil {
return nil, err
}
return &GetSubTreeResponseReader{
r: wc,
}, nil
}
func TreeList(cli *client.Client,
req *tree.ListRequest,
opts ...client.CallOption,
) (*tree.ListResponse, error) {
resp := new(tree.ListResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeList), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
func Apply(cli *client.Client,
req *tree.ApplyRequest,
opts ...client.CallOption,
) (*tree.ApplyResponse, error) {
resp := new(tree.ApplyResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeApply), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}
type TreeServiceGetOpLogResponseReader struct {
r client.MessageReader
}
// Read reads response from the stream.
//
// Returns io.EOF of streaming is finished.
func (r *TreeServiceGetOpLogResponseReader) Read(resp *tree.GetOpLogResponse) error {
return r.r.ReadMessage(resp)
}
func GetOpLog(cli *client.Client,
req *tree.GetOpLogRequest,
opts ...client.CallOption,
) (*TreeServiceGetOpLogResponseReader, error) {
wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceTree, rpcTreeGetOpLog), req, opts...)
if err != nil {
return nil, err
}
return &TreeServiceGetOpLogResponseReader{
r: wc,
}, nil
}
func Healthcheck(cli *client.Client,
req *tree.HealthcheckRequest,
opts ...client.CallOption,
) (*tree.HealthcheckResponse, error) {
resp := new(tree.HealthcheckResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceTree, rpcTreeHealthcheck), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}

View file

@ -207,24 +207,24 @@ func (x *XHeader) FromGRPCMessage(m grpc.Message) error {
return nil
}
func XHeadersToGRPC(xs []XHeader) (res []*session.XHeader) {
func XHeadersToGRPC(xs []XHeader) (res []session.XHeader) {
if xs != nil {
res = make([]*session.XHeader, 0, len(xs))
res = make([]session.XHeader, 0, len(xs))
for i := range xs {
res = append(res, xs[i].ToGRPCMessage().(*session.XHeader))
res = append(res, *xs[i].ToGRPCMessage().(*session.XHeader))
}
}
return
}
func XHeadersFromGRPC(xs []*session.XHeader) (res []XHeader, err error) {
func XHeadersFromGRPC(xs []session.XHeader) (res []XHeader, err error) {
if xs != nil {
res = make([]XHeader, len(xs))
for i := range xs {
err = res[i].FromGRPCMessage(xs[i])
err = res[i].FromGRPCMessage(&xs[i])
if err != nil {
return
}

View file

@ -1,606 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.1
// protoc v5.29.2
// source: api/session/grpc/service.proto
//go:build !protoopaque
package session
import (
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
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)
)
// Information necessary for opening a session.
type CreateRequest struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Body of a create session token request message.
Body *CreateRequest_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"`
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *RequestMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"`
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *RequestVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateRequest) Reset() {
*x = CreateRequest{}
mi := &file_api_session_grpc_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateRequest) ProtoMessage() {}
func (x *CreateRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_session_grpc_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *CreateRequest) GetBody() *CreateRequest_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *CreateRequest) GetMetaHeader() *RequestMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *CreateRequest) GetVerifyHeader() *RequestVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
func (x *CreateRequest) SetBody(v *CreateRequest_Body) {
x.Body = v
}
func (x *CreateRequest) SetMetaHeader(v *RequestMetaHeader) {
x.MetaHeader = v
}
func (x *CreateRequest) SetVerifyHeader(v *RequestVerificationHeader) {
x.VerifyHeader = v
}
func (x *CreateRequest) HasBody() bool {
if x == nil {
return false
}
return x.Body != nil
}
func (x *CreateRequest) HasMetaHeader() bool {
if x == nil {
return false
}
return x.MetaHeader != nil
}
func (x *CreateRequest) HasVerifyHeader() bool {
if x == nil {
return false
}
return x.VerifyHeader != nil
}
func (x *CreateRequest) ClearBody() {
x.Body = nil
}
func (x *CreateRequest) ClearMetaHeader() {
x.MetaHeader = nil
}
func (x *CreateRequest) ClearVerifyHeader() {
x.VerifyHeader = nil
}
type CreateRequest_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Body of a create session token request message.
Body *CreateRequest_Body
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *RequestMetaHeader
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *RequestVerificationHeader
}
func (b0 CreateRequest_builder) Build() *CreateRequest {
m0 := &CreateRequest{}
b, x := &b0, m0
_, _ = b, x
x.Body = b.Body
x.MetaHeader = b.MetaHeader
x.VerifyHeader = b.VerifyHeader
return m0
}
// Information about the opened session.
type CreateResponse struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Body of create session token response message.
Body *CreateResponse_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"`
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *ResponseMetaHeader `protobuf:"bytes,2,opt,name=meta_header,json=metaHeader" json:"meta_header,omitempty"`
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *ResponseVerificationHeader `protobuf:"bytes,3,opt,name=verify_header,json=verifyHeader" json:"verify_header,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateResponse) Reset() {
*x = CreateResponse{}
mi := &file_api_session_grpc_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateResponse) ProtoMessage() {}
func (x *CreateResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_session_grpc_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *CreateResponse) GetBody() *CreateResponse_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *CreateResponse) GetMetaHeader() *ResponseMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *CreateResponse) GetVerifyHeader() *ResponseVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
func (x *CreateResponse) SetBody(v *CreateResponse_Body) {
x.Body = v
}
func (x *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) {
x.MetaHeader = v
}
func (x *CreateResponse) SetVerifyHeader(v *ResponseVerificationHeader) {
x.VerifyHeader = v
}
func (x *CreateResponse) HasBody() bool {
if x == nil {
return false
}
return x.Body != nil
}
func (x *CreateResponse) HasMetaHeader() bool {
if x == nil {
return false
}
return x.MetaHeader != nil
}
func (x *CreateResponse) HasVerifyHeader() bool {
if x == nil {
return false
}
return x.VerifyHeader != nil
}
func (x *CreateResponse) ClearBody() {
x.Body = nil
}
func (x *CreateResponse) ClearMetaHeader() {
x.MetaHeader = nil
}
func (x *CreateResponse) ClearVerifyHeader() {
x.VerifyHeader = nil
}
type CreateResponse_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Body of create session token response message.
Body *CreateResponse_Body
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
MetaHeader *ResponseMetaHeader
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
VerifyHeader *ResponseVerificationHeader
}
func (b0 CreateResponse_builder) Build() *CreateResponse {
m0 := &CreateResponse{}
b, x := &b0, m0
_, _ = b, x
x.Body = b.Body
x.MetaHeader = b.MetaHeader
x.VerifyHeader = b.VerifyHeader
return m0
}
// Session creation request body
type CreateRequest_Body struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Session initiating user's or node's key derived `OwnerID`
OwnerId *grpc.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId" json:"owner_id,omitempty"`
// Session expiration `Epoch`
Expiration *uint64 `protobuf:"varint,2,opt,name=expiration" json:"expiration,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateRequest_Body) Reset() {
*x = CreateRequest_Body{}
mi := &file_api_session_grpc_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateRequest_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateRequest_Body) ProtoMessage() {}
func (x *CreateRequest_Body) ProtoReflect() protoreflect.Message {
mi := &file_api_session_grpc_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *CreateRequest_Body) GetOwnerId() *grpc.OwnerID {
if x != nil {
return x.OwnerId
}
return nil
}
func (x *CreateRequest_Body) GetExpiration() uint64 {
if x != nil && x.Expiration != nil {
return *x.Expiration
}
return 0
}
func (x *CreateRequest_Body) SetOwnerId(v *grpc.OwnerID) {
x.OwnerId = v
}
func (x *CreateRequest_Body) SetExpiration(v uint64) {
x.Expiration = &v
}
func (x *CreateRequest_Body) HasOwnerId() bool {
if x == nil {
return false
}
return x.OwnerId != nil
}
func (x *CreateRequest_Body) HasExpiration() bool {
if x == nil {
return false
}
return x.Expiration != nil
}
func (x *CreateRequest_Body) ClearOwnerId() {
x.OwnerId = nil
}
func (x *CreateRequest_Body) ClearExpiration() {
x.Expiration = nil
}
type CreateRequest_Body_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Session initiating user's or node's key derived `OwnerID`
OwnerId *grpc.OwnerID
// Session expiration `Epoch`
Expiration *uint64
}
func (b0 CreateRequest_Body_builder) Build() *CreateRequest_Body {
m0 := &CreateRequest_Body{}
b, x := &b0, m0
_, _ = b, x
x.OwnerId = b.OwnerId
x.Expiration = b.Expiration
return m0
}
// Session creation response body
type CreateResponse_Body struct {
state protoimpl.MessageState `protogen:"hybrid.v1"`
// Identifier of a newly created session
Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
// Public key used for session
SessionKey []byte `protobuf:"bytes,2,opt,name=session_key,json=sessionKey" json:"session_key,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreateResponse_Body) Reset() {
*x = CreateResponse_Body{}
mi := &file_api_session_grpc_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreateResponse_Body) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateResponse_Body) ProtoMessage() {}
func (x *CreateResponse_Body) ProtoReflect() protoreflect.Message {
mi := &file_api_session_grpc_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
func (x *CreateResponse_Body) GetId() []byte {
if x != nil {
return x.Id
}
return nil
}
func (x *CreateResponse_Body) GetSessionKey() []byte {
if x != nil {
return x.SessionKey
}
return nil
}
func (x *CreateResponse_Body) SetId(v []byte) {
if v == nil {
v = []byte{}
}
x.Id = v
}
func (x *CreateResponse_Body) SetSessionKey(v []byte) {
if v == nil {
v = []byte{}
}
x.SessionKey = v
}
func (x *CreateResponse_Body) HasId() bool {
if x == nil {
return false
}
return x.Id != nil
}
func (x *CreateResponse_Body) HasSessionKey() bool {
if x == nil {
return false
}
return x.SessionKey != nil
}
func (x *CreateResponse_Body) ClearId() {
x.Id = nil
}
func (x *CreateResponse_Body) ClearSessionKey() {
x.SessionKey = nil
}
type CreateResponse_Body_builder struct {
_ [0]func() // Prevents comparability and use of unkeyed literals for the builder.
// Identifier of a newly created session
Id []byte
// Public key used for session
SessionKey []byte
}
func (b0 CreateResponse_Body_builder) Build() *CreateResponse_Body {
m0 := &CreateResponse_Body{}
b, x := &b0, m0
_, _ = b, x
x.Id = b.Id
x.SessionKey = b.SessionKey
return m0
}
var File_api_session_grpc_service_proto protoreflect.FileDescriptor
var file_api_session_grpc_service_proto_rawDesc = []byte{
0x0a, 0x1e, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72,
0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x11, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x1a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x66, 0x73, 0x2f, 0x67, 0x72,
0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c,
0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63,
0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc0, 0x02, 0x0a,
0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39,
0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e,
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42,
0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74,
0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24,
0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65,
0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65,
0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73,
0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48,
0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61,
0x64, 0x65, 0x72, 0x1a, 0x5a, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x32, 0x0a, 0x08, 0x6f,
0x77, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f,
0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12,
0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20,
0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22,
0xa1, 0x02, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46,
0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61,
0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79,
0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e,
0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65,
0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x37, 0x0a, 0x04, 0x42, 0x6f,
0x64, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02,
0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65,
0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
0x4b, 0x65, 0x79, 0x32, 0x5f, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12,
0x20, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x21, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x42, 0x65, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73,
0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f,
0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x73, 0x64,
0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1b,
0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e,
0x41, 0x50, 0x49, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x08, 0x65, 0x64, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x70, 0xe8, 0x07,
}
var file_api_session_grpc_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_api_session_grpc_service_proto_goTypes = []any{
(*CreateRequest)(nil), // 0: neo.fs.v2.session.CreateRequest
(*CreateResponse)(nil), // 1: neo.fs.v2.session.CreateResponse
(*CreateRequest_Body)(nil), // 2: neo.fs.v2.session.CreateRequest.Body
(*CreateResponse_Body)(nil), // 3: neo.fs.v2.session.CreateResponse.Body
(*RequestMetaHeader)(nil), // 4: neo.fs.v2.session.RequestMetaHeader
(*RequestVerificationHeader)(nil), // 5: neo.fs.v2.session.RequestVerificationHeader
(*ResponseMetaHeader)(nil), // 6: neo.fs.v2.session.ResponseMetaHeader
(*ResponseVerificationHeader)(nil), // 7: neo.fs.v2.session.ResponseVerificationHeader
(*grpc.OwnerID)(nil), // 8: neo.fs.v2.refs.OwnerID
}
var file_api_session_grpc_service_proto_depIdxs = []int32{
2, // 0: neo.fs.v2.session.CreateRequest.body:type_name -> neo.fs.v2.session.CreateRequest.Body
4, // 1: neo.fs.v2.session.CreateRequest.meta_header:type_name -> neo.fs.v2.session.RequestMetaHeader
5, // 2: neo.fs.v2.session.CreateRequest.verify_header:type_name -> neo.fs.v2.session.RequestVerificationHeader
3, // 3: neo.fs.v2.session.CreateResponse.body:type_name -> neo.fs.v2.session.CreateResponse.Body
6, // 4: neo.fs.v2.session.CreateResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader
7, // 5: neo.fs.v2.session.CreateResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader
8, // 6: neo.fs.v2.session.CreateRequest.Body.owner_id:type_name -> neo.fs.v2.refs.OwnerID
0, // 7: neo.fs.v2.session.SessionService.Create:input_type -> neo.fs.v2.session.CreateRequest
1, // 8: neo.fs.v2.session.SessionService.Create:output_type -> neo.fs.v2.session.CreateResponse
8, // [8:9] is the sub-list for method output_type
7, // [7:8] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
}
func init() { file_api_session_grpc_service_proto_init() }
func file_api_session_grpc_service_proto_init() {
if File_api_session_grpc_service_proto != nil {
return
}
file_api_session_grpc_types_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_session_grpc_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_api_session_grpc_service_proto_goTypes,
DependencyIndexes: file_api_session_grpc_service_proto_depIdxs,
MessageInfos: file_api_session_grpc_service_proto_msgTypes,
}.Build()
File_api_session_grpc_service_proto = out.File
file_api_session_grpc_service_proto_rawDesc = nil
file_api_session_grpc_service_proto_goTypes = nil
file_api_session_grpc_service_proto_depIdxs = nil
}

866
api/session/grpc/service_frostfs.pb.go generated Normal file
View file

@ -0,0 +1,866 @@
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package session
import (
json "encoding/json"
fmt "fmt"
grpc "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/grpc"
pool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/pool"
proto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto"
encoding "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/util/proto/encoding"
easyproto "github.com/VictoriaMetrics/easyproto"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
strconv "strconv"
)
type CreateRequest_Body struct {
OwnerId *grpc.OwnerID `json:"ownerId"`
Expiration uint64 `json:"expiration"`
}
var (
_ encoding.ProtoMarshaler = (*CreateRequest_Body)(nil)
_ encoding.ProtoUnmarshaler = (*CreateRequest_Body)(nil)
_ json.Marshaler = (*CreateRequest_Body)(nil)
_ json.Unmarshaler = (*CreateRequest_Body)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *CreateRequest_Body) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.NestedStructureSize(1, x.OwnerId)
size += proto.UInt64Size(2, x.Expiration)
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *CreateRequest_Body) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *CreateRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if x.OwnerId != nil {
x.OwnerId.EmitProtobuf(mm.AppendMessage(1))
}
if x.Expiration != 0 {
mm.AppendUint64(2, x.Expiration)
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *CreateRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "CreateRequest_Body")
}
switch fc.FieldNum {
case 1: // OwnerId
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "OwnerId")
}
x.OwnerId = new(grpc.OwnerID)
if err := x.OwnerId.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 2: // Expiration
data, ok := fc.Uint64()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Expiration")
}
x.Expiration = data
}
}
return nil
}
func (x *CreateRequest_Body) GetOwnerId() *grpc.OwnerID {
if x != nil {
return x.OwnerId
}
return nil
}
func (x *CreateRequest_Body) SetOwnerId(v *grpc.OwnerID) {
x.OwnerId = v
}
func (x *CreateRequest_Body) GetExpiration() uint64 {
if x != nil {
return x.Expiration
}
return 0
}
func (x *CreateRequest_Body) SetExpiration(v uint64) {
x.Expiration = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *CreateRequest_Body) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *CreateRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"ownerId\":"
out.RawString(prefix)
x.OwnerId.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"expiration\":"
out.RawString(prefix)
out.RawByte('"')
out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Expiration, 10)
out.RawByte('"')
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *CreateRequest_Body) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *CreateRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "ownerId":
{
var f *grpc.OwnerID
f = new(grpc.OwnerID)
f.UnmarshalEasyJSON(in)
x.OwnerId = f
}
case "expiration":
{
var f uint64
r := in.JsonNumber()
n := r.String()
v, err := strconv.ParseUint(n, 10, 64)
if err != nil {
in.AddError(err)
return
}
pv := uint64(v)
f = pv
x.Expiration = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
type CreateRequest struct {
Body *CreateRequest_Body `json:"body"`
MetaHeader *RequestMetaHeader `json:"metaHeader"`
VerifyHeader *RequestVerificationHeader `json:"verifyHeader"`
}
var (
_ encoding.ProtoMarshaler = (*CreateRequest)(nil)
_ encoding.ProtoUnmarshaler = (*CreateRequest)(nil)
_ json.Marshaler = (*CreateRequest)(nil)
_ json.Unmarshaler = (*CreateRequest)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *CreateRequest) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.NestedStructureSize(1, x.Body)
size += proto.NestedStructureSize(2, x.MetaHeader)
size += proto.NestedStructureSize(3, x.VerifyHeader)
return size
}
// ReadSignedData fills buf with signed data of x.
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
//
// Returns any error encountered which did not allow writing the data completely.
// Otherwise, returns the buffer in which the data is written.
//
// Structures with the same field values have the same signed data.
func (x *CreateRequest) SignedDataSize() int {
return x.GetBody().StableSize()
}
// SignedDataSize returns size of the request signed data in bytes.
//
// Structures with the same field values have the same signed data size.
func (x *CreateRequest) ReadSignedData(buf []byte) ([]byte, error) {
return x.GetBody().MarshalProtobuf(buf), nil
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *CreateRequest) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *CreateRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if x.Body != nil {
x.Body.EmitProtobuf(mm.AppendMessage(1))
}
if x.MetaHeader != nil {
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
}
if x.VerifyHeader != nil {
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *CreateRequest) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "CreateRequest")
}
switch fc.FieldNum {
case 1: // Body
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Body")
}
x.Body = new(CreateRequest_Body)
if err := x.Body.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 2: // MetaHeader
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
}
x.MetaHeader = new(RequestMetaHeader)
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 3: // VerifyHeader
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
}
x.VerifyHeader = new(RequestVerificationHeader)
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
}
}
return nil
}
func (x *CreateRequest) GetBody() *CreateRequest_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *CreateRequest) SetBody(v *CreateRequest_Body) {
x.Body = v
}
func (x *CreateRequest) GetMetaHeader() *RequestMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *CreateRequest) SetMetaHeader(v *RequestMetaHeader) {
x.MetaHeader = v
}
func (x *CreateRequest) GetVerifyHeader() *RequestVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
func (x *CreateRequest) SetVerifyHeader(v *RequestVerificationHeader) {
x.VerifyHeader = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *CreateRequest) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *CreateRequest) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *CreateRequest) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *CreateRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "body":
{
var f *CreateRequest_Body
f = new(CreateRequest_Body)
f.UnmarshalEasyJSON(in)
x.Body = f
}
case "metaHeader":
{
var f *RequestMetaHeader
f = new(RequestMetaHeader)
f.UnmarshalEasyJSON(in)
x.MetaHeader = f
}
case "verifyHeader":
{
var f *RequestVerificationHeader
f = new(RequestVerificationHeader)
f.UnmarshalEasyJSON(in)
x.VerifyHeader = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
type CreateResponse_Body struct {
Id []byte `json:"id"`
SessionKey []byte `json:"sessionKey"`
}
var (
_ encoding.ProtoMarshaler = (*CreateResponse_Body)(nil)
_ encoding.ProtoUnmarshaler = (*CreateResponse_Body)(nil)
_ json.Marshaler = (*CreateResponse_Body)(nil)
_ json.Unmarshaler = (*CreateResponse_Body)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *CreateResponse_Body) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.BytesSize(1, x.Id)
size += proto.BytesSize(2, x.SessionKey)
return size
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *CreateResponse_Body) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *CreateResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if len(x.Id) != 0 {
mm.AppendBytes(1, x.Id)
}
if len(x.SessionKey) != 0 {
mm.AppendBytes(2, x.SessionKey)
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *CreateResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "CreateResponse_Body")
}
switch fc.FieldNum {
case 1: // Id
data, ok := fc.Bytes()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Id")
}
x.Id = data
case 2: // SessionKey
data, ok := fc.Bytes()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "SessionKey")
}
x.SessionKey = data
}
}
return nil
}
func (x *CreateResponse_Body) GetId() []byte {
if x != nil {
return x.Id
}
return nil
}
func (x *CreateResponse_Body) SetId(v []byte) {
x.Id = v
}
func (x *CreateResponse_Body) GetSessionKey() []byte {
if x != nil {
return x.SessionKey
}
return nil
}
func (x *CreateResponse_Body) SetSessionKey(v []byte) {
x.SessionKey = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *CreateResponse_Body) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *CreateResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"id\":"
out.RawString(prefix)
if x.Id != nil {
out.Base64Bytes(x.Id)
} else {
out.String("")
}
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"sessionKey\":"
out.RawString(prefix)
if x.SessionKey != nil {
out.Base64Bytes(x.SessionKey)
} else {
out.String("")
}
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *CreateResponse_Body) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *CreateResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "id":
{
var f []byte
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.Id = f
}
case "sessionKey":
{
var f []byte
{
tmp := in.Bytes()
if len(tmp) == 0 {
tmp = nil
}
f = tmp
}
x.SessionKey = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
type CreateResponse struct {
Body *CreateResponse_Body `json:"body"`
MetaHeader *ResponseMetaHeader `json:"metaHeader"`
VerifyHeader *ResponseVerificationHeader `json:"verifyHeader"`
}
var (
_ encoding.ProtoMarshaler = (*CreateResponse)(nil)
_ encoding.ProtoUnmarshaler = (*CreateResponse)(nil)
_ json.Marshaler = (*CreateResponse)(nil)
_ json.Unmarshaler = (*CreateResponse)(nil)
)
// StableSize returns the size of x in protobuf format.
//
// Structures with the same field values have the same binary size.
func (x *CreateResponse) StableSize() (size int) {
if x == nil {
return 0
}
size += proto.NestedStructureSize(1, x.Body)
size += proto.NestedStructureSize(2, x.MetaHeader)
size += proto.NestedStructureSize(3, x.VerifyHeader)
return size
}
// ReadSignedData fills buf with signed data of x.
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
//
// Returns any error encountered which did not allow writing the data completely.
// Otherwise, returns the buffer in which the data is written.
//
// Structures with the same field values have the same signed data.
func (x *CreateResponse) SignedDataSize() int {
return x.GetBody().StableSize()
}
// SignedDataSize returns size of the request signed data in bytes.
//
// Structures with the same field values have the same signed data size.
func (x *CreateResponse) ReadSignedData(buf []byte) ([]byte, error) {
return x.GetBody().MarshalProtobuf(buf), nil
}
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
func (x *CreateResponse) MarshalProtobuf(dst []byte) []byte {
m := pool.MarshalerPool.Get()
defer pool.MarshalerPool.Put(m)
x.EmitProtobuf(m.MessageMarshaler())
dst = m.Marshal(dst)
return dst
}
func (x *CreateResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
if x == nil {
return
}
if x.Body != nil {
x.Body.EmitProtobuf(mm.AppendMessage(1))
}
if x.MetaHeader != nil {
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
}
if x.VerifyHeader != nil {
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
}
}
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
func (x *CreateResponse) UnmarshalProtobuf(src []byte) (err error) {
var fc easyproto.FieldContext
for len(src) > 0 {
src, err = fc.NextField(src)
if err != nil {
return fmt.Errorf("cannot read next field in %s", "CreateResponse")
}
switch fc.FieldNum {
case 1: // Body
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "Body")
}
x.Body = new(CreateResponse_Body)
if err := x.Body.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 2: // MetaHeader
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
}
x.MetaHeader = new(ResponseMetaHeader)
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
case 3: // VerifyHeader
data, ok := fc.MessageData()
if !ok {
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
}
x.VerifyHeader = new(ResponseVerificationHeader)
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
return fmt.Errorf("unmarshal: %w", err)
}
}
}
return nil
}
func (x *CreateResponse) GetBody() *CreateResponse_Body {
if x != nil {
return x.Body
}
return nil
}
func (x *CreateResponse) SetBody(v *CreateResponse_Body) {
x.Body = v
}
func (x *CreateResponse) GetMetaHeader() *ResponseMetaHeader {
if x != nil {
return x.MetaHeader
}
return nil
}
func (x *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) {
x.MetaHeader = v
}
func (x *CreateResponse) GetVerifyHeader() *ResponseVerificationHeader {
if x != nil {
return x.VerifyHeader
}
return nil
}
func (x *CreateResponse) SetVerifyHeader(v *ResponseVerificationHeader) {
x.VerifyHeader = v
}
// MarshalJSON implements the json.Marshaler interface.
func (x *CreateResponse) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
x.MarshalEasyJSON(&w)
return w.Buffer.BuildBytes(), w.Error
}
func (x *CreateResponse) MarshalEasyJSON(out *jwriter.Writer) {
if x == nil {
out.RawString("null")
return
}
first := true
out.RawByte('{')
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"body\":"
out.RawString(prefix)
x.Body.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"metaHeader\":"
out.RawString(prefix)
x.MetaHeader.MarshalEasyJSON(out)
}
{
if !first {
out.RawByte(',')
} else {
first = false
}
const prefix string = "\"verifyHeader\":"
out.RawString(prefix)
x.VerifyHeader.MarshalEasyJSON(out)
}
out.RawByte('}')
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (x *CreateResponse) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
x.UnmarshalEasyJSON(&r)
return r.Error()
}
func (x *CreateResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "body":
{
var f *CreateResponse_Body
f = new(CreateResponse_Body)
f.UnmarshalEasyJSON(in)
x.Body = f
}
case "metaHeader":
{
var f *ResponseMetaHeader
f = new(ResponseMetaHeader)
f.UnmarshalEasyJSON(in)
x.MetaHeader = f
}
case "verifyHeader":
{
var f *ResponseVerificationHeader
f = new(ResponseVerificationHeader)
f.UnmarshalEasyJSON(in)
x.VerifyHeader = f
}
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}

View file

@ -0,0 +1,45 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package session
func DoFuzzProtoCreateRequest(data []byte) int {
msg := new(CreateRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONCreateRequest(data []byte) int {
msg := new(CreateRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoCreateResponse(data []byte) int {
msg := new(CreateResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONCreateResponse(data []byte) int {
msg := new(CreateResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -0,0 +1,31 @@
//go:build gofuzz
// +build gofuzz
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
package session
import (
testing "testing"
)
func FuzzProtoCreateRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoCreateRequest(data)
})
}
func FuzzJSONCreateRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONCreateRequest(data)
})
}
func FuzzProtoCreateResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoCreateResponse(data)
})
}
func FuzzJSONCreateResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONCreateResponse(data)
})
}

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.29.2
// - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.2
// source: api/session/grpc/service.proto
package session
@ -15,8 +15,8 @@ import (
// 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
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
SessionService_Create_FullMethodName = "/neo.fs.v2.session.SessionService/Create"
@ -25,11 +25,6 @@ const (
// SessionServiceClient is the client API for SessionService 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.
//
// `SessionService` allows to establish a temporary trust relationship between
// two peer nodes and generate a `SessionToken` as the proof of trust to be
// attached in requests for further verification. Please see corresponding
// section of FrostFS Technical Specification for details.
type SessionServiceClient interface {
// Open a new session between two peers.
//
@ -49,9 +44,8 @@ func NewSessionServiceClient(cc grpc.ClientConnInterface) SessionServiceClient {
}
func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateResponse)
err := c.cc.Invoke(ctx, SessionService_Create_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, SessionService_Create_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -60,12 +54,7 @@ func (c *sessionServiceClient) Create(ctx context.Context, in *CreateRequest, op
// SessionServiceServer is the server API for SessionService service.
// All implementations should embed UnimplementedSessionServiceServer
// for forward compatibility.
//
// `SessionService` allows to establish a temporary trust relationship between
// two peer nodes and generate a `SessionToken` as the proof of trust to be
// attached in requests for further verification. Please see corresponding
// section of FrostFS Technical Specification for details.
// for forward compatibility
type SessionServiceServer interface {
// Open a new session between two peers.
//
@ -76,17 +65,13 @@ type SessionServiceServer interface {
Create(context.Context, *CreateRequest) (*CreateResponse, error)
}
// UnimplementedSessionServiceServer should 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 UnimplementedSessionServiceServer struct{}
// UnimplementedSessionServiceServer should be embedded to have forward compatible implementations.
type UnimplementedSessionServiceServer struct {
}
func (UnimplementedSessionServiceServer) Create(context.Context, *CreateRequest) (*CreateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedSessionServiceServer) testEmbeddedByValue() {}
// UnsafeSessionServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SessionServiceServer will
@ -96,13 +81,6 @@ type UnsafeSessionServiceServer interface {
}
func RegisterSessionServiceServer(s grpc.ServiceRegistrar, srv SessionServiceServer) {
// If the following call pancis, it indicates UnimplementedSessionServiceServer 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(&SessionService_ServiceDesc, srv)
}

Some files were not shown because too many files have changed in this diff Show more